#include
std::string input;
std::cin >> input;
The user wants to enter \"Hello World\". But cin
fails at the spa
You have to use cin.getline():
char input[100];
cin.getline(input,sizeof(input));
You want to use the .getline function in cin.
#include <iostream>
using namespace std;
int main () {
char name[256], title[256];
cout << "Enter your name: ";
cin.getline (name,256);
cout << "Enter your favourite movie: ";
cin.getline (title,256);
cout << name << "'s favourite movie is " << title;
return 0;
}
Took the example from here. Check it out for more info and examples.