Computer5k
Spy
- Joined
- Sep 15, 2003
- Messages
- 839
- Reaction score
- 0
I'm just learning c++ and am not understanding something. The program is supposed to display this.
but the text won't allign right. I'm only using the text formatting functions of iostream.h for this. My current code is this.
If anyone knows why this is please respond.
EDIT: also the only things covered at this point in the book for formatting are cout.width and cout.setf
Code:
Julie Andrews Guinevere
Richard Burton King Arthur
Robert Goulet Sir Lancelot
but the text won't allign right. I'm only using the text formatting functions of iostream.h for this. My current code is this.
Code:
#include <iostream.h>
int main()
{
cout.width(15); cout.setf(ios::left); cout << "Julie Andrews";
cout.width(15); cout.setf(ios::right); cout << "Guinevere";
cout << endl;
cout.width(15); cout.setf(ios::left); cout << "Richard Burton";
cout.width(15); cout.setf(ios::right); cout << "King Arthur";
cout << endl;
cout.width(15); cout.setf(ios::left); cout << "Robert Goulet";
cout.width(15); cout.setf(ios::right); cout << "Lancelot";
cout << endl;
return(0);
}
EDIT: also the only things covered at this point in the book for formatting are cout.width and cout.setf