0

How to enter user Input for Scanf..

how to use user input for scanf

5th Jan 2017, 3:41 PM
Ashish Singh
Ashish Singh - avatar
1 Antwort
+ 2
scanf("formatstring", &var) is the function that put whatever the user types and enters in the variable var (if the format string and the kind of variable match). Though this function is used in C language only. If you want to use the user input in C++ you need to use the function cin>>var. In this case you don't use a format string but still be sure that the kind of variable you have declared before matches with the kind of input given by the user (e.g. char* variables require a string of carachters as content). Hope this was helpful and code on ; )
6th Jan 2017, 9:14 PM
infinity
infinity - avatar