xxxxxxxxxx
#include <iostream>
using namespace std;
int main(){
string text;
int num;
//cin
//cout <<"Text: ";
//cin >> text; //will not consider any thing written after the space
//cout <<"Text using cin: " << text << endl;
//getline
cout <<"Text: ";
getline(cin, text); // will terminate only when a new line is inserted
cout <<"Text using getline: " << text << endl;
//cin.ignore
cout << "Number: ";
cin >> num;
cout <<"Text: ";
cin.ignore(); //ignore what is saved inside the cin (new line)
getline(cin, text);
cout <<"Text using cin.ignore: " << text << endl;
}