A Newbie's question in C++
Hi,
Well this is very simple program. But it isnt working. Giving me three errors when compiled using VC++. However i compiled the same program with borland C++ and i didnt get any errors.
Code:
#include <iostream.h>
#include <string.h>
int main()
{
string userName;
cout << "What is your Name? ";
cin >> userName;
cout << "Hello " << userName << "!" << endl;
return 0;
}
The errors are as follows
--------------------Configuration: hello3 - Win32 Debug--------------------
Compiling...
hello.cpp
C:\Workspace\Practise\hello3\hello.cpp(6) : error C2065: 'string' : undeclared identifier
C:\Workspace\Practise\hello3\hello.cpp(6) : error C2146: syntax error : missing ';' before identifier 'userName'
C:\Workspace\Practise\hello3\hello.cpp(6) : error C2065: 'userName' : undeclared identifier
Error executing cl.exe.
hello3.exe - 3 error(s), 0 warning(s)
Please help