how can i print 3 values(without knowing their string\number size) in same column using cout?
i'm using these code:

cout <<"\n" << "show tokens\n";
        for(unsigned int i=0;i<Tokens.size(); i++)
        {
            cout << "Token: " << Tokens[i].Token <<right<<setw(20-Tokens[i].Token.size())<< "Type: " << Tokens[i].Type <<setw(40) << fixed << "Position Line: " << i<<"\n";
        }

but i know the 'token' size, but not the type size. so what you can advice me?

Since we don't know the output terminal, you could make the assumption it's not variable spacing and some TTY device.

Convert each number to a string then pad left or right with spaces as needed. Of course if the font is variable width then it's not going to work but no one can guess what the output device is. Teletype (I used those), terminals or a Norhstar which had the variable width character set.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.