// my includes and namespace
#include <iostream>
#include <limits>
usingnamespace std;
int main ()
{
// declaring variables:
int a, b;
int result;
// process:
a = 90;
b = 30;
result = a - b;
// print out the result:
cout << result;
cout <<"\n";
// Enter to close
std::cout << "Press ENTER to close window...";
std::cin.ignore( std::numeric_limits<std::streamsize>::max(), '\n' );
return 0;
}
If you notice, I have recently discovered a method of creating a new line in my "application" using ccout <<"\n";
My question is.... Is this the best way to generate a new line in my console? is there a more widely accepted method or faster?
You can use endl to generate a new line. Try the following to generate three new lines:
cout << endl << endl << endl;
Also, endl flushes the buffer for buffered streams, "\n" does not. also I find it easier to simply type endl then hitting shift twice to get the double quotations. It's a matter of preference, if you're not heavily using buffered streams.