Simple compile time/cout error

I am trying to make a table for my beginners C++ class. In doing so, I have been using the Cout command. My question is, Is there a limit to how many characters i can have on a single cout command? i would like to display this whole table using a single cout statement.

The following code is my table. As is, I am getting a simple compile time error. "[Error] expected ';' before string constant" (on the line that starts with taxes) I can fix it by making more Cout statements, but as stated previously, I would like to organize this code as is. Am i forgetting something?

Thanks
-Awillits

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
  int main() 
{
   cout.setf(ios::fixed);         
   cout.setf(ios::showpoint);     
   cout.precision(2);             

	cout << "Item" << setw(36) << "Projected\n"
	        "=============  " << "==========\n"
	        "Income" << setw(10) << "$" << setw(9) << 1000.00 << endl
	        "Taxes" << setw(11) << "$" << setw(9) << 100.00 << endl
	        "Living" << setw(10) << "$" << setw(9) << 650.00 << endl
	        "Other" << setw(11) << "$" << setw(9) << 90.00 << endl
	        "=============  " << "==========\n"
	        "Delta" << setw(11) << "$" << setw(9) << 60.00 << endl;

	return 0;
}
You're forgetting the insertion operator (<<).

1
2
3
4
5
6
7
8
cout << "Item" << setw(36) << "Projected\n"
     << "=============  " << "==========\n"
     << "Income" << setw(10) << "$" << setw(9) << 1000.00 << endl
     << "Taxes" << setw(11) << "$" << setw(9) << 100.00 << endl
     << "Living" << setw(10) << "$" << setw(9) << 650.00 << endl
     << "Other" << setw(11) << "$" << setw(9) << 90.00 << endl
     << "=============  " << "==========\n"
     << "Delta" << setw(11) << "$" << setw(9) << 60.00 << endl;
Ah, Thanks! I don't think ill forget this in the future.
Topic archived. No new replies allowed.