0

How to input int and string datatype in one line?

24th Aug 2018, 5:29 AM
Tincture
2 Réponses
+ 3
Ayshi below is the one : int a; string b; cin >> a>> b; cout << a << endl << b;
24th Aug 2018, 6:02 AM
Ketan Lalcheta
Ketan Lalcheta - avatar
0
If you want to input a number with message in one line you should not to put std:: endl or \n at the end of the message. cout << "Input integer number :"; int n =0; cin >> n;
24th Aug 2018, 8:11 AM
Sergey Ushakov
Sergey Ushakov - avatar