Hi,
I'm a beginner having problems with writing my hello world program.
I am using the tutorial on this site, because it seems easy to understand.
Allthough the coding I have made is the exact same as in the tutorial I can't run the program.
The error I get is:
Unable to start program 'C:\users\morten\documents\visual studio 2008\projects\test\debug\test.exe
The file does not exist
I am using Microsoft Visual C++ 2008 Express Edition.
I suggest you:
- create a new Empty Project
- copy/paste your code -or move the files- into the new project
- delete the old project
- compile the new project, it should work
#include <iostream>
#include <limits> // for numeric_limits
usingnamespace std;
int main ()
{
cout << "Hello World!";
cin.ignore ( numeric_limits<streamsize>::max(), '\n' ); // "The Standard Way" in the article
return 0;
}
The program is closing as soon as I press enter, is there a way that I can "delay" the closing of the program so I can se the program after pressing enter?
To get a string, you use getline(cin, mystr); //mystr is a string
You can also use getline() to get an integer or character, but no directly, you must use an alternative method (http://www.cplusplus.com/forum/articles/6046/ shows you how to get all 3 types of input that can handle invalid input).