iomanip problem

Here the code and the output but it doesn't make sense...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
    cout << endl;

    cout << "Coke World!";
    cout << setfill( '-' ) << setw( 18 ) << endl; // there an end line but it doesn't end the line?

    cout << "1: Cola\n";
    cout << "2: Mountain Dew\n";
    cout << "3: Pepsi\n";
    cout << "4: Purple drank\n"; 
    cout << "5: Orange drink\n";


    return( 0 );
}



Coke World!
-----------1: cola
2: mountain dew
3: pepsi
4: purple drank
5: orange


To my knowledge, the setfill and setw() effect only the next single output statement, if you want all lines to look like that you could create a loop or define each one, line by line.
The endl is coming after "Coke World!" like it should. There is no newline after Coke World!, the endl does exactly like it should. Then setfill()/setw() only affect Cola.
WOW... LOL I can't believe that I missed that... I was reading what you guys said and looking at my code and it came to me lol....
cout << setfill( '-' ) << setw( 18 ) << " " << endl;

Thanks a lot... Sorry it was such an easy question.
Topic archived. No new replies allowed.