[Solved] Scanf c++ on a string [closed]


If the first 3 are digits and the last one is a character and are seperated by a space,which you want to assign to 3 integer variables and a character variable, use scanf like this:

int a,b,c;
char ch; 
scanf ("%d%d%d %c",&a,&b,&c,&ch);

Or else if you want to extract 3 integers and a character from a string , use sscanf. It is not possible to do it with scanf.

solved Scanf c++ on a string [closed]