0

How to capture multiple sentences in C++?

I ask this question because my program need 2 sentences to type. int main(){ string p1, p2; char np1, np2; cout << "Please type a sentence" << endl; cin >> p1; cout << "\nThe sentence is true or not?" << endl; cin >> np1; cout << "\nType a sentence again" << endl; cin >> p2; cout << "\nThe sentence is true or not?" << endl; cin >> np2; ... When using cin, the first word user type trigger the next code when the user press space. When using getline(cin, p1), after the user press enter,it skip the last code

11th Sep 2017, 10:11 AM
Dewangga Putra Sheradhien
Dewangga Putra Sheradhien - avatar
2 odpowiedzi
+ 3
https://www.sololearn.com/discuss/372045/?ref=app Try this .
11th Sep 2017, 10:35 AM
Solo Wanderer 4315
Solo Wanderer 4315 - avatar