I'm new to C++, and I was following the tutorials on this website. I'm using visual studio 2008 and when I run the program it terminates just when it starts. Here is the code:
1 2 3 4 5 6 7 8 9 10
// my first program in C++
#include <iostream>
usingnamespace std;
int main ()
{
cout << "Hello World!";
return 0;
}
This is the process I follow:
I make a .cpp file containing the code above, and then in VS I choose File\New\Project From Existing Code
Then I choose C++ as the project type, I browse the folder containing the .cpp file as the project file location. Then I choose console application project. Afte that I run the program, and a cmd window appears containing the Hello World! text and then the program ends instansly.
I wonder, is the code supposed to act in this way? Or do I do something wrong in Visual Studio?