C语言实习题目源代码(2)

2020-04-14 23:10

strcpy(tongxunlu[j-1].tel,tongxunlu[j].tel); strcpy(tongxunlu[j].tel,temp); strcpy(temp,tongxunlu[j-1].mail); strcpy(tongxunlu[j-1].mail,tongxunlu[j].mail); strcpy(tongxunlu[j].mail,temp); } } }

void insert()//新增联系人信息 {

int i=n,j,flag; //定义变量

printf(\请输入待增加的联系人数:\\n\scanf(\do { flag=1; while(flag) { flag=0;

for(j=0;j

printf(\请输入第 %d 个联系人的姓名:\\n\ printf(\请输入第 %d 个联系人的性别:\\n\ printf(\请输入第 %d 个联系人的地址:\\n\ printf(\请输入第 %d 个联系人的电话:\\n\

printf(\请输入第 %d 个联系人的E-mail:\\n\scanf(\if(flag==0) { i=i; i++; } }

while(i

printf(\录入完毕!\\n\\n\ void del() //删除联系人 { int i,j,flag=0; char s1[LEN+1]; //定义变量 printf(\请输入要删除联系人的号码:\\n\ if(strcmp(tongxunlu[i].tel,s1)==0) { flag=1; //比较字符串 for(j=i;j

for(i=0;i

} }

void save() //数据的存储 { int i; FILE *fp; //声明fp是FILE型指针 fp=fopen(\输入数据的写入 for(i=0;i

} fclose(fp); }

void menu()//系统登录界面 { int num; printf(\ printf(\ 通 讯 录 信 息 管 理 系 统 \\n\\n\ printf(\ printf(\系统功能菜单*******************\\n\ printf(\ printf(\ printf(\刷新联系人**************2.查询联系人*****\\n\ printf(\修改联系人**************4.增加联系人*****\\n\ printf(\删除联系人**************6.显示当前联系人*\\n\ printf(\保存当前学生信息********8.退出系统*******\\n\ printf(\ printf(\ 请输入操作序号:\ scanf(\ switch(num) //对应选项的操作 {

case 1:readfile();break; //联系人数据的读取录入 case 2:seek();break;//联系人数据的查询 case 3:modify();break;//联系人数据的修改 case 4:insert();break;//增加联系人数据 case 5:del();break; //删除联系人 case 6:display();break;

case 7:save();break; case 8:k=0;break;

default:printf(\请在1-8之间选择\\n\ } return; }

题目二源代码 #include #include #include int a,b,c,d,e,f,g; int o,p,q,r,s,t,u; int judge() { //中特等奖和一等奖的情况 if(a==o&&b==p&&c==q&&d==r&&e==s&&f==t) { if(g==u) { printf(\恭喜您中了特等奖,按任意键结束\\n\ getch(); return 0; } else { printf(\恭喜您中了一等奖,按任意键结束\\n\ getch(); return 0; } } //中二等奖的情况 if(a==o&&b==p&&c==q&&d==r&&e==s&&f!=t) { printf(\恭喜您中了二等奖,按任意键结束\\n\

getch(); return 0; }

if(a==p&&b==q&&c==r&&d==s&&e==t) { printf(\恭喜您中了二等奖,按任意键结束\\n\ getch();return 0; }

if(b==o&&c==p&&d==q&&e==r&&f==s) { printf(\恭喜您中了二等奖,按任意键结束\\n\ getch();return 0; }

if(a!=o&&b==p&&c==q&&d==r&&e==s&&f==t) { printf(\恭喜您中了二等奖,按任意键结束\\n\ getch();return 0; }

//中三等奖的情况

if(a==o&&b==p&&c==q&&d==r&&e!=s) { printf(\恭喜您中了三等奖,按任意键结束\\n\ getch(); return 0; }

if(b==o&&c==p&&d==q&&e==r&&f!=s) { printf(\恭喜您中了三等奖,按任意键结束\\n\ getch(); return 0; }

if(c==o&&d==p&&e==q&&f==r) { printf(\恭喜您中了三等奖,按任意键结束\\n\ getch(); return 0; }

if(a==p&&b==q&&c==r&&d==s&&e!=t) { printf(\恭喜您中了三等奖,按任意键结束\\n\

getch(); return 0; }

if(a!=o&&b==p&&c==q&&d==r&&e==s&&f!=t) { printf(\恭喜您中了三等奖,按任意键结束\\n\ getch(); return 0; }

if(b!=o&&c==p&&d==q&&e==r&&f==s) { printf(\恭喜您中了三等奖,按任意键结束\\n\ getch();return 0; }

if(a==q&&b==r&&c==s&&d==t) { printf(\恭喜您中了三等奖,按任意键结束\\n\ getch(); return 0; }

if(a!=p&&b==q&&c==r&&d==s&&e==t) { printf(\恭喜您中了三等奖,按任意键结束\\n\ getch(); return 0; }

if(b!=p&&c==q&&d==r&&e==s&&f==t) { printf(\恭喜您中了三等奖,按任意键结束\\n\ getch();return 0; }

//中四等奖情况

if(a==o&&b==p&&c==q&&d!=r) { printf(\恭喜您中了四等奖,按任意键结束\\n\ getch(); return 0; }

if(b==o&&c==p&&d==q&&e!=r) { printf(\恭喜您中了四等奖,按任意键结束\\n\ getch();


C语言实习题目源代码(2).doc 将本文的Word文档下载到电脑 下载失败或者文档不完整,请联系客服人员解决!

下一篇:延安市宝塔区和乐洗煤厂节能评估

相关阅读
本类排行
× 注册会员免费下载(下载后可以自由复制和排版)

马上注册会员

注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信: QQ: