编程C语言时中英文出错,C语言程序设计 教小学生英语 里面有代码运行错误,怎么改...

该楼层疑似违规已被系统折叠 隐藏此楼查看此楼

编了一个星期了,找了好多错误原因没找到,我好笨啊

下面是我代码

#include

#include

#include

#include

#define SIZE 100//声明函数,结构

void zero();//主显示界面

void select();//选择界面

void save();//保存界面函数

void save1();//保存单词函数

void save2();//保存短语函数

void save3();//保存短句函数

void see();//查看词库界面

void see1();//查看单词词库

void see2();//查看短语词库

void see3();//查看短句词库

void one();//学习单词函数

void two();//学习短语函数

void three();//学习短句函数

struct word_list

{ char a1[10];

char b1[10];

}word[SIZE];

struct phrase_list

{ char a2[20];

char b2[20];

}phrase[SIZE];

struct sentence_list

{ char a3[100];

char b3[100];

}sentence[SIZE];

//定义函数

void main()

{zero();

select();}

void zero()

{printf("\n");

printf("\n\n\n");

printf("\t| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|\n");

printf("\t| |\n");

printf("\t| |\n");

printf("\t| ------快-乐-学-习——快-乐-成-长----- |\n");

printf("\t| |\n");

printf("\t| love me, love English! |\n");

printf("\t| |\n");

printf("\t| |\n");

printf("\t| 1.开始学习 |\n");

printf("\t| |\n");

printf("\t| 2.扩大词库 |\n");

printf("\t| |\n");

printf("\t| 3.查看词库 |\n");

printf("\t| |\n");

printf("\t| 4.退出系统 |\n");

printf("\t| |\n");

printf("\t| |\n");

printf("\t| |\n");

printf("\t|~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|\n");

}

void select()

{ int a;

printf("\t\t 请选择: ");

scanf("%d",&a);

switch(a)

{

case 1:one();break;

case 2:save();break;

case 3:see();break;

case 4:exit(0);

default: printf("error\n");

}

}

void save()

{int b;

printf("\n");

printf("\n");

printf("\t\t|~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|\n");

printf("\t\t| |\n");

printf("\t\t| ------快-乐-学-习—&&&—快-乐-成-长----- |\n");

printf("\t\t| |\n");

printf("\t\t| !!!love me, love english!!! |\n");

printf("\t\t| |\n");

printf("\t\t| 1.记录单词 |\n");

printf("\t\t| |\n");

printf("\t\t| 2.记录词组 |\n");

printf("\t\t| |\n");

printf("\t\t| 3.记录句子 |\n");

printf("\t\t| |\n");

printf("\t\t| 4.返回 |\n");

printf("\t\t| |\n");

printf("\t\t|~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|\n");

printf("\t\t 请输入: ");

scanf("\n %d",&b);

switch(b)

{

case 1:save1();break;

case 2:save2();break;

case 3:save3();break;

case 4:zero(); select();break;

default: printf("error\n");

}

}

void save1()

{int i,j,m1;

FILE *fp1,*fi1;

if((fp1=fopen("word_list","r"))==NULL)

{fp1=fopen("word_list","wb");fclose(fp1);}

if((fi1=fopen("c1","r"))==NULL)

{m1=0;

fi1=fopen("c1","wb");

fwrite(&m1,sizeof(int),1,fi1);

fclose(fi1);}

if((fi1=fopen("c1","rb"))!=NULL)

{

fi1=fopen("c1","rb");

fread(&m1,sizeof(int),1,fi1);

i=m1;

}

for(i;i<=SIZE;i++)

{if(m1>=(SIZE-1))

{printf("\n---------------------------已存满,不能存入数据--------------------------");

break;}

else

{printf("请输入英文单词:");

getchar();

gets(word[i].a1);

printf("\n请输入中文词语:");

gets(word[i].b1);

if((fp1=fopen("word_list","ab"))==NULL)

{

printf("cannot open file\n");

exit(0);

}

if(fwrite(&word[i],sizeof(struct word_list),1,fp1)!=1)

printf("file write error\n");

fclose(fp1);

m1=m1+1;

if((fi1=fopen("c1","wb"))==NULL)

{

printf("cannot open file\n");

exit(0);

}

if(fwrite(&m1,sizeof(int),1,fi1)!=1)

printf("file write error\n");

fclose(fi1);

printf("\t\t \n");

printf("\t\t \n");

printf("\t\t|~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|\n");

printf("\t\t| |\n");

printf("\t\t|----------记录成功!是否继续记录单词-----------|\n");

printf("\t\t| |\n");

printf("\t\t| |\n");

printf("\t\t| 1.继续--- |\n");

printf("\t\t| |\n");

printf("\t\t| 2.退出--- |\n");

printf("\t\t| |\n");

printf("\t\t| |\n");

printf("\t\t|~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|\n");

printf("\t\t 请输入: ");

scanf("%d",&j);

if(j==1) ;

else if(j==2)

break;

}}

zero();

select();

}

void save2()

{int i,j,m2;

FILE *fp2,*fi2;

if((fp2=fopen("phrase_list","r"))==NULL)

{fp2=fopen("phrase_list","wb");fclose(fp2);}

if((fi2=fopen("c2","r"))==NULL)

{m2=0;

fi2=fopen("c2","wb");

fwrite(&m2,sizeof(int),1,fi2);

fclose(fi2);}

if((fi2=fopen("c2","rb"))!=NULL)

{

fi2=fopen("c2","rb");

fread(&m2,sizeof(int),1,fi2);

i=m2;

}

for(i;i<=SIZE;i++)

{if(m2>=(SIZE-1))

{printf("\n---------------------------已存满,不能存入数据--------------------------");

break;}

else

{printf("请输入英文短语:");

getchar();

gets(phrase[i].a2);

printf("\n请输入中文短语:");

gets(phrase[i].b2);

if((fp2=fopen("phrase_list","ab"))==NULL)

{

printf("cannot open file\n");

exit(0);

}

if(fwrite(&phrase[i],sizeof(struct phrase_list),1,fp2)!=1)

printf("file write error\n");

fclose(fp2);

m2=m2+1;

if((fi2=fopen("c2","wb"))==NULL)

{

printf("cannot open file\n");

exit(0);

}

if(fwrite(&m2,sizeof(int),1,fi2)!=1)

printf("file write error\n");

fclose(fi2);

printf("\t\t \n");

printf("\t\t \n");

printf("\t\t|~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|\n");

printf("\t\t| |\n");

printf("\t\t|----------记录成功!是否继续记录单词-----------|\n");

printf("\t\t| |\n");

printf("\t\t| |\n");

printf("\t\t| 1.继续--- |\n");

printf("\t\t| |\n");

printf("\t\t| 2.退出--- |\n");

printf("\t\t| |\n");

printf("\t\t| |\n");

printf("\t\t|~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|\n");

printf("\t\t 请输入: ");

scanf("%d",&j);

if(j==1) ;

else if(j==2)

break;

}}

zero();

select();

}

void save3()

{int i,j,m3;

FILE *fp3,*fi3;

if((fp3=fopen("sentence_list","r"))==NULL)

{fp3=fopen("sentence_list","wb");fclose(fp3);}

if((fi3=fopen("c3","r"))==NULL)

{m3=0;

fi3=fopen("c3","wb");

fwrite(&m3,sizeof(int),1,fi3);

fclose(fi3);}

if((fi3=fopen("c3","rb"))!=NULL)

{

fi3=fopen("c3","rb");

fread(&m3,sizeof(int),1,fi3);

i=m3;

}

for(i;i<=SIZE;i++)

{if(m3>=(SIZE-1))

{printf("\n---------------------------已存满,不能存入数据--------------------------");

break;}

else

{printf("请输入英文短句:");

getchar();

gets(sentence[i].a3);

printf("\n请输入中文短句:");

gets(sentence[i].b3);

if((fp3=fopen("sentence_list","ab"))==NULL)

{

printf("cannot open file\n");

exit(0);

}

if(fwrite(&sentence[i],sizeof(struct sentence_list),1,fp3)!=1)

printf("file write error\n");

fclose(fp3);

m3=m3+1;

if((fi3=fopen("c3","wb"))==NULL)

{

printf("cannot open file\n");

exit(0);

}

if(fwrite(&m3,sizeof(int),1,fi3)!=1)

printf("file write error\n");

fclose(fi3);

printf("\t\t \n");

printf("\t\t \n");

printf("\t\t|~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|\n");

printf("\t\t| |\n");

printf("\t\t|----------记录成功!是否继续记录单词-----------|\n");

printf("\t\t| |\n");

printf("\t\t| |\n");

printf("\t\t| 1.继续--- |\n");

printf("\t\t| |\n");

printf("\t\t| 2.退出--- |\n");

printf("\t\t| |\n");

printf("\t\t| |\n");

printf("\t\t|~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|\n");

printf("\t\t 请输入: ");

scanf("%d",&j);

if(j==1) ;

else if(j==2)

break;

}}

zero();

select();

}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值