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 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.