samedi 26 août 2017

confusion with getline and direction assign cin to string

string input_a; string input_b;

cout << "Input a :" ;
getline(cin,input_a);

cout << "Input b :" ;
cin >> input_b;

cout << "Input a :" << input_a <<endl
     << "Input b :" << input_b;
return 0;

how does getline(cin,input_a) and cin >> input_b work internally to accept an input value. What is the difference and when to apply properly. Confusion, especially on comparing a given strin

Aucun commentaire:

Enregistrer un commentaire