6 hours ago,Sven Groot wrote
A few points:
- _tmain is not standard C++
- What's in stdafx.h since you included all headers actually used by the program directly in the file?
- It doesn't do the same thing as the C# version or what androidi specified, as you use operator>> which stops extraction when it encounters a space; it doesn't read the whole line. Also the C++ version doesn't write a newline, and the C# version does.
- Explicitly initialization an std:: string with an empty string literal is pointless.
Didn't want to find the setting to disable precompiled headers, but since you insisted...
#include <iostream>#include <string>using namespace std;int main(int argc, char* argv[]){ string entry; cout << "Please enter your name."; getline(cin, entry); cout << "Hello, " << entry << endl; return 0;}