Using the code shown below I am not able to get any kind of result, it just prompts me with my directory again. Using G++ as a compiler. I've been looking extensively through these forums and have not had any luck. Any help is greatly appreciated!
#include <iostream>
using namespace std;
int main()
{
int x = 5;
int y = 7;
cout << "\n";
cout << x + y << " " << x * y;
cout << "\n";
return 0;
}
After the last cout statement, you need to flush the output buffer. That's a block of memory where the data for the stream is stored temporarily, before it is sent to the screen or disk file.
Use either cout << flush; or cout << endl; after the output statements. endl actually outputs a newline character and then flushes the output.