C语言程序错误0xa3,急,在线等,关于d:\cc\c1_1.c(3) : error C2018: unknown character ’0xa3’错误...

#include"stdlib.h"

#include"stdio.h"

#include"ctype.h"

#include"string.h"

FILE*fp;

void fun()

{

int i;

int s=0;

char ch;

int t=0;

char p[80],ch1[80];

while(1)

{

switch(s)

{

case 0:ch=fgetc(fp);

if(ch=='0')s=4;

else if(ch=='

else if(ch=='=')s=9;

else if(ch=='>')s=10;

else if(ch=='+')s=14;

else if(ch=='-')s=15;

else if(ch=='*')s=16;

else if(ch=='/')s=17;

else if(ch=='=')s=18;

else if(ch==',')s=19;

else if(ch==';')s=20;

else if(ch=='(')s=21;

else if(ch1=="begin")s=24;

else if(ch1=="end")s=25;

else if(ch1=="if")s=26;

else if(ch1=="else")s=27;

else if (ch1=="then")s=28;

if(isalpha(ch))

{

s=1;

for(i=0;i<80;i++)

{p[i]=i;}

}

else

{printf("词法错误");

break;

}

if(isdigit(ch))

{s=3;

t=ch-'0';

}

else

{

printf("词法错误");

return ;

break;

}

case 1:ch=fgetc(fp);

if(isalnum(ch))

{s=1;

p[i]=i;

i++;

}

else s=2;

break;

case 2:printf("(0,内部字符串),%c",p[i]);

s=0;

fseek(fp,-1,1);

break;

case 3:ch=fgetc(fp);

if(isdigit(ch))

{s=3;

t=t*10+(ch-'0');

}

break;

case 4:printf("(1,整数值),%d",t);

s=0;

fseek(fp,-1,1);

break;

case 5:ch=fgetc(fp);

if(ch=='=')s=6;

else if(ch=='>')s=7;

else s=8;

break;

case 6:printf("(2,LE)");

s=0;

break;

case 7:printf("(2,NE)");

s=0;

break;

case 8:printf("(2,LT)");

s=0;

fseek(fp,-1,1);

break;

case 9:ch=fgetc(fp);

if(ch=='=')

s=11;

break;

case 10:ch=fgetc(fp);

if(ch=='=')

s=12;

else s=13;

break;

case 11:printf("(2,EQ)");

s=0;

break;

case 12:printf("(2,GE)");

s=0;

break;

case 13:printf("(2,GT)");

s=0;

fseek(fp,-1,1);

break;

case 14:printf("(3, )");

s=0;

break;

case 15:printf("(4, )");

s=0;

break;

case 16:printf("(5, )");

s=0;

break;

case 17:printf("(6, )");

s=0;

break;

case 18:printf("(7, )");

s=0;

break;

case 19:printf("(9, 分界符)");

s=0;

break;

case 20:printf("(9, 分界符)");

s=0;

break;

case 21:ch=fgetc(fp);

if(ch==')')

s=22;

else s=23;

break;

case 22:printf("(9,分界符)");

s=0;break;

case 23:printf("(9,分界符)");

s=0;

fseek(fp,-1,1);

break;

case 24:printf("(8,begin)");

s=0;

break;

case 25:printf("(8,end)");

s=0;

break;

case 26:printf("(8,if)");

s=0;

break;

case 27:printf("(8,then)");

s=0;break;

case 28:printf("(8,else)");

s=0;

break;

}

}

}

void main()

{

if((fp=fopen("file.txt","r"))==NULL)

{printf("can not open the file!\n");

exit(0);

}

fun();

printf("\n");

}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值