could someone offer some help
i have used the search feature and read up on setw() and still no luck
I have some data which i am holding in a vector of structs and would like to print them in a formatted list
i can't even get this simple program to line up some strings of varying length
i have tried all sorts of combos (with and without my "" added)
I am compiling in bloodhsed
Code:
#include <iostream.h>
#include <stdlib.h>
#include <string>
#include <iomanip>
using namespace std;
int main()
{
string a("This is a test");
string b("This is only a test");
string c("Line me up");
cout << "" << setw(20) << a;
cout << "" << setw(11)<< c << endl;
cout << setw(20) << b;
cout << "" << setw(11) << c << endl;
system("PAUSE");
return 0;
}
output:
Code:
This is a test Line me up
This is only a test Line me up
can someone please tell me what i am doing wrong so i can align text with strings of varying length
thanks