home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.disi.unige.it
/
2015-02-11.ftp.disi.unige.it.tar
/
ftp.disi.unige.it
/
pub
/
.person
/
CataniaB
/
teach-act
/
esempi
/
Stringhe
/
stringToInt.c
< prev
Wrap
C/C++ Source or Header
|
1999-03-11
|
271b
|
18 lines
/* conversione da stringa ad intero positivo */
#include <stdio.h>
int main()
{
unsigned char c = '0';
int i = 0;
printf("Inserire un intero: ");
while (c >= '0' && c <= '9')
{
i = 10 * i + c - '0';
c = getchar();
}
printf("\n%d\n",i);
}