#include
int main(void)
{
FILE *fp;
char ch;
int i = 0;
char a[1024];
fp = fopen("./test.txt", "rw");
if(fp == NULL)
{
printf("cannot open file!\n");
exit(1);
}
ch = fgetc(fp);
while(ch != EOF)
{
a[i++] = ch;
ch = fgetc(fp);
}
a[i] = '\0';
printf("a = %s\n", a);
int val = atoi(a);
printf(" a = %d\n", val);
int ret;
if((val >= 3300)||(val < 3525))
{
ret = 1;
}
else if((val >= 3525 )||(val < 3750))
{
ret = 2;
}
else if((val >= 3750)||(val < 3975))
{
ret = 3;
}
else if((val >= 3975)||(val <= 4200))
{
ret = 4;
}
switch(ret)
{
case 1:
printf("1\n");
break;
case 2:
printf("2\n");
break;
case 3:
printf("3\n");
break;
fault:
break;
}
return 0;
}
~
阅读(802) | 评论(0) | 转发(0) |