You are viewing a single comment's thread. Return to all comments →
We can use getchar() as well in place of cin.ignore(). Here is my code :
int i1; double d1; string s1; cin >> i1; cin >> d1; getchar();//cin.ignore(); getline(cin,s1); s.append(s1); cout << i+i1 <<endl<<fixed<<setprecision(1)<<d+d1 <<endl <<s;
Seems like cookies are disabled on this browser, please enable them to open this website
Day 1: Data Types
You are viewing a single comment's thread. Return to all comments →
We can use getchar() as well in place of cin.ignore(). Here is my code :