c++ - cin with a string
- st <st_member pathlink.com> Mar 16 2003
This compiles but does not execute:
//(code has been shortened on purpose)
#include <iostream.h>
#include <string>
string something;
int main()
{
cout << "Enter your name: ";
cin >> something;
}
This compiles and executes properly:
#include <iostream.h>
#include <string>
char something[40];
int main()
{
cout << "Enter your name: ";
cin >> something;
}
Why won't a string work with cin?
Mar 16 2003








st <st_member pathlink.com>