+ 2

C++ Input

What does this do? cin >> a >> b; Does it store the Input in both a and b so that means a and b will have the same value?

28th Dec 2017, 10:50 PM
Khanh Dao
Khanh Dao - avatar
2 Réponses
+ 10
This allows a user to input multiple values separated by whitespace. In this case, the first input goes in a, the second in b.
28th Dec 2017, 11:13 PM
Tamra
Tamra - avatar
+ 1
It does the same thing as cin >> a; cin >> b; if a & b are int and the following data was entered, 5 6 a becomes 5 and b becomes 6.
29th Dec 2017, 1:06 AM
John Wells
John Wells - avatar