|
|
|
|
|
|
|
This statement produces the output |
|
|
|
|
|
|
|
|
If you want even more spacing between items, use string constants containing blanks: |
|
|
|
|
|
|
|
|
cout << "Results: " << i << " " << j << " " << k; |
|
|
|
|
|
|
|
|
Here, the resulting output is |
|
|
|
|
|
|
|
|
As another example, to produce this output: |
|
|
|
|
|
|
|
|
* * * * * * * * *
* * * * * * * * * *
* * * * * * * * * |
|
|
|
|
|
|
|
|
you would use these statements: |
|
|
|
|
|
|
|
|
cout << " * * * * * * * * *" << endl << endl;
cout << "* * * * * * * * * *" << endl << endl;
cout << " * * * * * * * * *" << endl; |
|
|
|
|
|
|
|
|
All of the blanks and asterisks are enclosed in double quotes, so they print literally as they are written in the program. The extra endl manipulators give you the blank lines between the rows of asterisks. |
|
|
|
|
|
|
|
|
If you want blanks to be printed, you must enclose them in quotes. The statement |
|
|
|
|
|
|
|
|
Despite all of the blanks we included in the output statement, the asterisks print side by side because the blanks are not enclosed by quotes. |
|
|
|
|
|