how we can get info from the user?(input) | Sololearn: Learn to code for FREE!
Новый курс! Каждый программист должен знать генеративный ИИ!
Попробуйте бесплатный урок
0

how we can get info from the user?(input)

26th Jun 2016, 12:14 PM
Reyhaneh
Reyhaneh - avatar
2 ответов
+ 1
there are several ways... but first you need to know what do you want from the user? you take a single variable like this cin>>(variable name); if you want to take multiple input then cin>>(var 1)>>(var 2)>>..... (var n); if you want to take a string inuput then you can use cin the same way as above but there are some functions also, like gets (var-name); getline (var-name); ....etc ther is a function that can also take input of any datarype scanf (); do a google search on it as kain says...scanf () is a c function so you may not focus on learning it but you can use it in c++.
26th Jun 2016, 12:21 PM
Mukul Kumar
Mukul Kumar - avatar
0
Mukul: scanf is C, not C++.
26th Jun 2016, 2:44 PM
Garme Kain
Garme Kain - avatar