The method that should be used when reading input with spaces:
<1> String string :
#include <string>
string a;
getline (cin, a);
<2>Character array char :
The first:
#include <cstdio>
char[10] a;
gets(a);
The second:
#include <iostream>
char[10] a;
cin.getline (a, 10);
//cin.get(a,10);