i need to make a program that gets input in format 8:7:60 but only processes the numbers. the 3 numbers are stored in 3 different variables.
1 Replies - 148 Views - Last Post: 15 January 2013 - 09:57 PM
#1
how to get input in format 5:60:8 but only store the integers.
Posted 15 January 2013 - 09:45 PM
Replies To: how to get input in format 5:60:8 but only store the integers.
#2
Re: how to get input in format 5:60:8 but only store the integers.
Posted 15 January 2013 - 09:57 PM
Check on the man page on scanf. You can suppress input by specifying a "*" before the format type specifier.
For example, the following will take the format of integer-character-integer while suppressing the character assignment.
For example, the following will take the format of integer-character-integer while suppressing the character assignment.
int a, c;
scanf("%d%*c%d", &a, &c);
Page 1 of 1
|
|

New Topic/Question
Reply



MultiQuote



|