3
My program must read big numbers(0<=X<=10 (100)), what I’m doing is he reads/interprets the typed numbers as char
and store in a chained list.
My show was fine, until I put one scanf("%d")
(whose function is to read a natural number of cases) above the scanf
who reads the numbers X...
So, I would like to know how to format the input of scanf()
so that it can read numeric characters one by one and at the end when pressing ENTER.
There is a solution?
Part of my code:
scanf("%d", &t);
while(caso <= t)
{
lista_ini = NULL;
while((scanf("%c", &caract) == 1) && ((caract >= '0') && (caract <= '9')))
{
lista_ini = lst_insere(lista_ini, (caract - 48));
}
...
Thanks.
I got it all figured out, buddy! Thanks
– pcccj
I just couldn’t accomplish using the getchar, but okay.
– pcccj
I’ll set an example for you tomorrow.
– Jorge B.