- Joined
- Apr 14, 2012
- Messages
- 2,585
- Reaction score
- 0
- Points
- 36
Hey everyone,
Its been several months since I coded my first program, but Ive restarted my study of C++ programming in the last few weeks. Im posting here to see if anyone can help me with an issue Im having in writing console programs in Windows 7.
Absolutely stunning isnt it :lol:
Anyways, I have no problems compiling and running the program, but for some reason when I run it on my computer with windows 7, the program runs for a split second, then shuts down. I can tell that its working, as I can just make out some details on the screen in the flash that it is running, but Im now moving on to using cout and cin for input/output, so Ill need to find a way to make it stay on screen. Can anyone offer advice on this?
Its been several months since I coded my first program, but Ive restarted my study of C++ programming in the last few weeks. Im posting here to see if anyone can help me with an issue Im having in writing console programs in Windows 7.
Code:
// my first program in C++
#include <iostream>
#include <string>
using namespace std;
int main ()
{
string Hello = "Hello World!";
cout <<Hello; return 0;
}
Absolutely stunning isnt it :lol:
Anyways, I have no problems compiling and running the program, but for some reason when I run it on my computer with windows 7, the program runs for a split second, then shuts down. I can tell that its working, as I can just make out some details on the screen in the flash that it is running, but Im now moving on to using cout and cin for input/output, so Ill need to find a way to make it stay on screen. Can anyone offer advice on this?