#include <iostream>
using namespace std;
int main() {
int Variable = 5;
cout << Variable << endl; //any string that is requested to be called out by the system below will not appear.
}
So I compiled the program into an executable and run the executable, there were no errors , however when the variable was to be called on the command prompt, the value of it isn't displayed and any string after it isn't displayed either. Anything before cout << Variable << endl;
seems to display. If I were to write a simple "hello world" program(no variables whatsoever) it would run normally displaying every string in the correct order.
This is your code, with some more additions, and it works perfectly! Seems to me that your environment needs a return
statement.
Try appending return 0;
at the end of main()
, else there is no error with the code!
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.