When i try to enter in a number to the compiled code on the black screen, the black screen shuts off once i enter a number and press enter. It compiles so the code cant be wrong.
#include <iostream>
usingnamespace std;
int main()
{
int number;
cout << "Enter an integer and I will tell you if it" << endl;
cout << "is odd or even." << endl;
cin >> number;
if (number % 2 == 0)
cout << number << " is even.\n";
else
cout << number << " is odd.\n";
return 0;
}
lol it compiles so it can't be wrong? I wouldn't bet on this going forward :)
That aside,
you have 4 main choices.
1) you can open a console, navigate to the program, and run it via "dos" commands.
2) you can add the command "system("pause"); before "return 0;"
3) you can write a batch file to call the program and append the system pause to it outside the code.
4) you can read in a bogus value at the end of the program (cin >> bogus or something)