C语言大作业

copy
#include<stdio.h> #include<stdlib.h> struct student{ char id[100]; char stu[110]; char sco[110]; }a[1100]; int cnt; char* b[10]; char s[6][110]; void print1(){ printf("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\t\t\t\t\t\t\t");} void print2(){ printf("\t\t\t\t\t\t\t"); } void init(){ system("mode con cols=130 lines=42"); print1(); printf("C语言教学管理平台\n"); print2(); system("pause"); } void pre1(){ print1(); printf("基础知识部分 输入 1\n"); print2(); printf("能力提高部分 输入 2\n"); print2(); printf("知识扩展部分 输入 3\n"); print2(); printf("返回 输入 4\n"); print2(); } void pre2(){ print1(); printf("知识点讲解 输入 1\n"); print2(); printf("案例代码 输入 2\n"); print2(); printf("案例演示 输入 3\n"); print2(); printf("返回 输入 4\n"); print2(); } int solve(int k){ if(k==1) return 1; if(k==2) return 2; return solve(k-1)+solve(k-2); } int cmp(char* x,char* y){ int i=0; while(1){ if(*(x+i)<*(y+i)) return 1; if(*(x+i)>*(y+i)) return 0; i++; } } void one(){ system("cls"); pre2(); int x; scanf("%d",&x); system("cls"); if(x==1){ FILE *fp=fopen( "./函数递归知识点.txt","r"); char ch; while((ch=fgetc(fp))!=EOF){ printf("%c",ch); } fclose(fp); system("pause"); one(); } if(x==2){ FILE *fp=fopen("./楼梯代码.txt","r"); char ch; while((ch=fgetc(fp))!=EOF){ printf("%c",ch); } fclose(fp); system("pause"); one(); } if(x==3){ printf("输入n"); int n; scanf("%d",&n); printf("%d",solve(n)); system("pause"); one(); } if(x==4) return; } void two(){ system("cls"); pre2(); int x; scanf("%d",&x); system("cls"); if(x==1){ FILE *fp=fopen( "./指针数组知识点.txt","r"); char ch; while((ch=fgetc(fp))!=EOF){ printf("%c",ch); } fclose(fp); system("pause"); two(); } if(x==2){ FILE *fp=fopen("./字符串排序.txt","r"); char ch; while((ch=fgetc(fp))!=EOF){ printf("%c",ch); } fclose(fp); system("pause"); two(); } if(x==3){ fflush(stdin); for(int i=0;i<5;i++){ gets(s[i]); b[i+1]=&s[i][0]; // printf("%d\n",i); } for(int i=1;i<=4;i++){ for(int j=1;j<=5-i;j++){ if(!cmp(b[j],b[j+1])){ char *t=b[j]; b[j]=b[j+1]; b[j+1]=t; } } } for(int i=1;i<=5;i++){ printf("%s\n",b[i]); } system("pause"); two(); } if(x==4) return; } void three(){ system("cls"); print1(); printf("案例代码 输入 1\n"); print2(); printf("案例演示 输入 2\n"); print2(); printf("返回 输入 3\n"); int x; scanf("%d",&x); system("cls"); if(x==1){ FILE *fp=fopen("./学生统计.txt","r"); char ch; while((ch=fgetc(fp))!=EOF){ printf("%c",ch); } fclose(fp); system("pause"); three(); } if(x==2){ while(1){ cnt++; printf("输入学生学号:"); scanf("%s",a[cnt].id); printf("输入学生姓名:"); scanf("%s",a[cnt].stu); printf("输入学生成绩:"); scanf("%s",a[cnt].sco); printf("结束输入输入end,继续输入输入continue: "); char x[100]; scanf("%s",x); if(x[0]=='e') break; } printf("学号 姓名 成绩\n"); for(int i=1;i<=cnt;i++){ printf("%s %s %s\n",a[i].id,a[i].stu,a[i].sco); } system("pause"); three(); } if(x==3) return; } int main(){ init(); system("cls"); while(1){ pre1(); int x; scanf("%d",&x); system("cls"); if(x==1) one(); if(x==2) two(); if(x==3) three(); if(x==4) init(); system("cls"); } return 0; } ```
posted @   Aswert  阅读(62)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 震惊!C++程序真的从main开始吗?99%的程序员都答错了
· 【硬核科普】Trae如何「偷看」你的代码?零基础破解AI编程运行原理
· 单元测试从入门到精通
· winform 绘制太阳,地球,月球 运作规律
· 上周热点回顾(3.3-3.9)
历史上的今天:
2020-09-14 P1447 [NOI2010]能量采集
2020-09-14 考试总结
点击右上角即可分享
微信分享提示
💬
评论
📌
收藏
💗
关注
👍
推荐
🚀
回顶
收起