Pergunta

Basically what I'm trying to do is to distribute spaces equally between words of a given string. This is what I did:

istringstream s("En el infinito y mas alla"); 
string token;
while( s >> token )
{
    cout << token << setw(10);
}

However, this is not working as expected. Anybody know why?

Foi útil?

Solução

may be this is what you want ?

 cout<< setw(10+token.size()) << token ;
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top