March 17, 2003 cin with a string | ||||
---|---|---|---|---|
| ||||
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? |
Copyright © 1999-2021 by the D Language Foundation