thanks, but its still not doign what i'd like
Please Enter in a positive number, then hit ENTER
dg
That is not an integer
[root@CPE0010b53e159e-CM root]# ./a.out
Please Enter in a positive number, then hit ENTER
5429764297625321
Good, you've entered an integer!The number you entered is: 2147483647
[root@CPE0010b53e159e-CM root]#
see?
how come its doing that weird thing, I just want it to see that its too big, then say it, and re-ask
I've fixed the re-ask part, with a for loop (I think)
Code:
#include <stdio.h>
unsigned int getInputData(){
unsigned int digit;
int i;
for(i=0;i<20;i++){
printf("Please Enter in a positive number, then hit ENTER\n");
if (scanf("%d", &digit) !=1){
printf("That is not an integer\n");
return(-1);}
else if (sizeof(digit)>4){
return(-1);}
else
printf("The number you entered is: %d\n", digit);
return(digit);}
}
int main(void){
getInputData();
return(0);
}
how do I use the tags?