New Line?

Hey

The program works fine, but i cant understand why it doesnt go to a new line

#include <iostream>
using namespace std;
int main ()
{
int a, b, c;
int result;

cout << "Input Interger A, B, C";
cin >> a;
cin >> b;
cin >> c;
result = a + b + c - 2;
cout << result;
/n; // please tell me what i did wrong?
system ("pause");
return 0;
}


Thanks
To have a newline you can do it 2 different ways.

Way 1.
 
cout << "first line" << endl << "2nd line";


Way 2.
 
cout << "FirstLine \nSecond Line";


The first way is prefered, as the end/endl command causes the cout buffer to be flushed and displayed instantly to the screen.

Z.
you needed cout<<"\n";
@buffbill
The "\n" and std::endl do basically the same thing but as Zaita pointed out above std::endl is should be used when using std::cout against "\n" for printf() type calls.
Last edited on
Topic archived. No new replies allowed.