當前位置:首頁 » 課程大全 » c語言課程設計記賬系統

c語言課程設計記賬系統

發布時間: 2021-02-14 11:25:56

A. C語言課程設計 學生管理系統設計

學生管理系統設計
我幫你弄
保證能運行
Q我

B. C語言課程設計,倉庫管理系統

已經私信你了 可以解決

C. 急求 C語言課程設計 設計一個課程信息管理系統

#include<stdio.h>
#include<string.h>
#include <stdlib.h>
#define N 10
struct majors //課程信息結構體
{
int num; // 課程編號
char majorsname[12]; //課程名稱
char teachername[15]; //授課老師
char clas[20]; //課程所屬專業(擴展功能)
int a,b,c; //學分 課號 價格(擴展功能)
double pjf; // 課程質量評分(擴展功能)
};

void main()
{
void shuru(struct majors stu[N]); //子函數定義
void chuli(struct majors stu[N]);
void xiugai(struct majors stu[N]);
void shuchu(struct majors stu[N]);
void paixu(struct majors stu[N]);
void chaxun(struct majors stu[N]);
void tongj(struct majors stu[N]);
double pjf(struct majors stu[N]);
void bjgkm(struct majors stu[N]);
struct majors stu[N];
int i=0,j=0,p=0,u=0;
char str[70][500];
FILE *fp1,*fp;
if((fp=fopen("課程信息.txt","r"))==NULL) //提示文件存檔問題
printf("注意:為免出錯,第一次使用本程序,請選1 手動輸入課程信息. \n");
else
{
for(i=1;i<=N;i++)
{
if(i==1)
fp=fopen("課程信息.txt","r");
fscanf(fp,"%d%s%s%s%d%d%d",&stu[i].num,stu[i].name,stu[i].teachername,stu[i].clas,&stu[i].a,&stu[i].b,&stu[i].c);
if(1==N)
fclose(fp);
}
}
int choice;
do{
for(i=0;i<18;i++)
printf("**");
printf("主菜單");
for(j=0;j<18;j++)
printf("**");
printf("\n");
printf("#請選擇:1 課程信息輸入 2課程信息修改與刪除 3 課程信息查詢 4 信息輸出 5 退出#\n");
for(i=0;i<20;i++)
printf("***");
printf("**\n");
scanf("%d",&choice);
switch(choice)
{
case 1 :
shuru(stu) ; break;
case 2 :
xiugai(stu) ; break;
case 3 :
chuli(stu) ; break;
case 4 :
shuchu(stu) ; break;
case 5 : break;
default : puts("error"); return;
}

} while(choice!=5);
fp1=fopen("課程信息.txt","w");
for(i=1;i<=N;i++)
{

fprintf(fp1,"%d ",stu[i].num);
fprintf(fp1,"%s ",stu[i].name);
fprintf(fp1,"%s ",stu[i].teachername);
fprintf(fp1,"%s ",stu[i].clas);
fprintf(fp1,"%d ",stu[i].a);
fprintf(fp1,"%d ",stu[i].b);
fprintf(fp1,"%d ",stu[i].c);
fprintf(fp1,"\n");
}
puts("信息已保存在「課程信息.txt」中 Thank you!!");
fclose(fp1);
}

void shuru(struct majors stu[N])
{
}
void chuli(struct majors stu[N])
{
}
void xiugai(struct majors stu[N])
{
}
void shuchu(struct majors stu[N])
{
}
void paixu(struct majors stu[N])
{
}
void chaxun(struct majors stu[N])
{
}
void tongj(struct majors stu[N])
{
}
//double pjf(struct majors stu[N])
//{

//}
void bjgkm(struct majors stu[N])
{
}

D. C語言課程設計家庭財務收支管理系統。主要包括收入、支出、查詢、修改、監控等功能。

學籍管理系統軟體需求分析________________________________________編著於博海、王利森、王艷梅、李岩、呂靖1引言信息社會的高科技,商品經濟化的高效益,使計算機的應用已普及到經濟和社會生活的各個領域。計算機雖然與人類的關系愈來愈密切,還有人由於計算機操作不方便繼續用手工勞動。為了適應現代社會人們高度強烈的時間觀念,學籍管理系統軟體為教學公室帶來了極大的方便。該軟體是以漢語編程語言為實現語言,其功能在系統內部有源代碼直接完成。通過操作手冊,使用者可以了解本軟體的基本工作原理。操作人員只需輸入一些簡單的漢字、數字,即可達到自己的目標。1.1編寫目的本需求的編寫目的在於研究學籍管理系統軟體的開發途徑和應用方法。本需求的預期讀者是與學籍管理系統軟體開發有聯系的決策人,開發組成人員,扶助開發者,支持本項目的領導和公司人員,軟體驗證者。1.2背景及范圍本項目的名稱:學籍管理系統開發軟體。本項目的任務提出者及開發者是學籍管理系統軟體開發小組,用戶是教學公室。本產品能具體化、合理化的管理學生的學籍檔案,用結構化的思維方式去了解計算機的基本工作原理和漢語程序設計語言。1.3定義縮寫詞略語漢語程序設計語言:它是由北京元易達科技發展有限責任公司完全自主開發,完全自主版權的計算機語言,以漢語字詞為結構,最大限度的利用漢語本身的特點,是一種基於漢語基礎的通用的計算機的程序設計語言。學籍管理系統:學籍管理是幫助教學人員、行政人員對人事檔案的管理軟體。使用漢語編程語言,獨立完成其功能。1.4參考資料>--------沈志斌編著電子工業出版社>--------王利福張世琨朱冰編著北京大學出版社>--------李紹原主編科學出版社2項目概述該學籍管理系統軟體目前已有比較完善的管理與使用功能,並且是計算機行業中用漢語編程來完成的新軟體成員。研製學籍管理系統軟體是為了滿足教學公室對學生檔案管理的方便,以現代化的創新思維模式去工作。2.1目標2.1.1開發意圖a.為了學籍管理系統更完善;b.為了教學公室對學生檔案的管理更方便;c.為了減輕行政人員的工作負擔。2.1.2應用目標通過本系統軟體,能幫助教研人員利用計算機,快速方便的對學生學籍管理進行管理、輸入、輸出、查找的所需操作,使散亂的人事檔案能夠具體化,直觀化、合理化。2.1.3作用及范圍本軟體適用於教育界,它是比較完善的系統管理軟體,對學生的學籍可以隨時輸入、輸出、查找。2.1.4背景現今學籍管理的繁索給具有強烈時間觀念的行政人員帶來了諸多不便,教學公室缺少一種完善的學籍管理軟體,為了對學生檔案的管理方便,因此開發了本軟體。2.2產品描述本產品是一種依賴於漢語編程為基礎的系統軟體,它是以漢語編程系統詞為基礎,用漢語程序設計語言進行編程的產品。2.3產品功能2.3.1外部功能學籍管理系統軟體具有輸入、輸出、查找功能。2.3.2內部功能該軟體集命令、編程、編輯於一體,完成過濾、定位顯示。2.3.3功能表2.3.4功能描述圖2.3.5用戶特點本軟體的使用對象是教學公室工作人員。會漢語、懂計算機的基本操作就可以利用該軟體進行所需操作。同時也會對漢語編程有認識。2.4一般約束a.本項目的開發經費不超過1萬元;b.輔導老師2人,開發人員6人;c.在管理方針,硬體的限制,並行操作安全和保密方面無約束。2.5假設和依據假設開發經費不到位,管理不完善,設計時沒能用全得到考慮,本項目的開發都將受到很大的影響。3具體需求3.1功能需求(一)3.1.1規格說明輸入每個人的具體信息3.1.2引言為了把個人信息(包括:學號、姓名、性別、年級、班級、系別、專業、戶口所在地、家庭住址、聯系電話、戶口分類、考前學歷、現今學歷、出生日期、民族、政治面貌、身份證號、文考准考證號、自考准考證號、填卡日期、備注)輸入到資料庫。3.1.3輸入個人信息。3.1.4加工通過學籍管理系統輸入到資料庫中。3.1.5輸出個人的全部信息。3.2功能需求(二)3.2.1規格說明查詢個人的全部信息。

E. C語言課程設計銀行管理小系統

我這有個個人收支管理系統,你看看是否用得上。
#include<stdio.h>
#include<string.h>
#define N 100
struct money
{
int shunxu;
int year;
int month;
int day;
char zhaiyao[50];
float jine;
float yue;
char bizhong[10];
int biao;

}in[N],out[N],temp[N],*pp,*qq;
void shouru(int x)
{

int i;
char ch;
system("cls");
if(x==1)
pp=in;
else
pp=out;
for(i=1;i<N;i++,pp++)
{
pp->shunxu=i;
pp->biao=x;
printf("\n日期(年 月 日)\t摘要\t金額\t幣種\n");
scanf("%d%d%d%s%f%s",&pp->year,&pp->month,&pp->day,pp->zhaiyao,&pp->jine, pp->bizhong );
printf("是否繼續輸入?1 是 2 否\n");
scanf("%s",&ch);
if(ch=='1')
continue;
else if(ch=='2')
break;
else
{

printf("error!");
system("pause");
break;
}

}
printf("是否保存:1是 2否\n");
scanf("%d",&i);
switch(i)
{
case 1:
if(x==1)
{
xieru(1);
break;
}
else
{
xieru(-1);
break;
}
case 2:
system("pause");
break;
default:
break;
}

}
mingxi()
{
FILE *f;
int y,m,d,y2,m2,d2;
int i;
system("cls");
pp=temp;
if((f=fopen("ff.txt","rt"))==NULL)
{
printf("文件打開錯誤!");
system("pause");
}
for(i=0;i<N;i++,pp++)
fscanf(f,"%d\t%d年%d月%d日\t%s\t%f\t%f\t%s\t%d\n",&pp->shunxu,&pp->year,&pp->month,&pp->day,pp->zhaiyao,&pp->jine,&pp->yue,pp->bizhong,&pp->biao);
pp=temp;
/*for(;pp->shunxu!=0;pp++)
printf("%d %s %f\n",pp->shunxu,pp->bizhong,pp->jine);*/
printf("輸入起止時間(年 月 日):\n");
scanf("%d%d%d%d%d%d",&y,&m,&d,&y2,&m2,&d2);
for(;pp->shunxu!=0;pp++)
{
if(pp->year>=y||pp->month>=m||pp->day>=d)
{

for(;pp->shunxu!=0;pp++)
{

if(pp->year>y2||pp->month>m2||pp->day>d2)
break;
printf("%d年%d月%d日\t%f\n",pp->year,pp->month,pp->day,pp->jine);
}
}

}

system("pause");

}
chaxun()
{
system("cls");
printf("建設中。。。");
system("pause");
}
xieru(int x)
{
FILE *f;
system("cls");
pp=in;
qq=out;
f=fopen("ff.txt","at+");
if(f==NULL)
{
printf("文件打開錯誤!");
system("pause");
}
if(x==1)
for(;pp->shunxu !=0;pp++)
{
fprintf(f,"%d\t%d年%d月%d日\t%s\t%f\t%f\t%s\t%d\n",pp->shunxu,pp->year,pp->month,pp->day,pp->zhaiyao,pp->jine,pp->yue,pp->bizhong,pp->biao);

}
else if(x==-1)
for(;qq->shunxu!=0;qq++)
{
fprintf(f,"%d\t%d年%d月%d日\t%s\t%f\t%f\t%s\t%d\n",qq->shunxu,qq->year,qq->month,qq->day,qq->zhaiyao,qq->jine,qq->yue,qq->bizhong,qq->biao);
}
else
{
for(;pp->shunxu !=0;pp++)
{
fprintf(f,"%d\t%d年%d月%d日\t%s\t%f\t%f\t%s\t%d\n",pp->shunxu,pp->year,pp->month,pp->day,pp->zhaiyao,pp->jine,pp->yue,pp->bizhong,pp->biao);

}
for(;qq->shunxu!=0;qq++)
{
fprintf(f,"%d\t%d年%d月%d日\t%s\t%f\t%f\t%s\t%d\n",qq->shunxu,qq->year,qq->month,qq->day,qq->zhaiyao,qq->jine,qq->yue,qq->bizhong,qq->biao);
}
}

fclose(f);
printf("保存成功!");
system("pause");
}
qu()
{
FILE *f;
char ch;
system("cls");

f=fopen("ff.txt","rb");
if(f==NULL)
{
printf("文件打開錯誤!");
system("pause");
}
ch=fgetc(f);
while(ch!=EOF)
{
putchar(ch);
ch=fgetc(f);
}
fclose(f);
system("pause");
}

void main()
{
int i=1,a;
for(;i!=0;)
{
system("cls");
printf("個人收支管理\n");
printf("1.收入\n2.支出\n3.明細表\n4.查詢與統計\n5.寫入文件\n6.讀取文件\n0.退出\n");
scanf("%d",&a);
switch(a)
{
case 1:
shouru(1);
break;
case 2:
shouru(-1);
break;
case 3:
mingxi();
break;
case 4:
chaxun();
break;
case 5:
xieru(0);
break;
case 6:
qu();
break;
case 0:
i=0;
break;

}

}

}

F. C語言課程設計,學生個人生活費管理系統

#include "stdio.h"
#define N 10
struct student
{char num[10];
char name[20];
float score[3];
float sum;
float aver;
}stu[N];
void main()
{
void count(struct student stu[]);
void sort(struct student stu[]);
void find(struct student stu[]);
int i;
float temp;
for(i=0;i<N;i++)
{printf("enter data of the%dth student:\n",i+1);
printf("number: ");
gets(stu[i].num);
printf("name: ");
gets(stu[i].name);
printf("score1: ");
scanf("%f",&temp);
stu[i].score[0]=temp;
printf("score2: ");
scanf("%f",&temp);
stu[i].score[1]=temp;
printf("score3: ");
scanf("%f",&temp);
getchar();
stu[i].score[2]=temp;
}
count(stu);
printf("\n");
sort(stu);
printf("\n");
find(stu);
}

void count(struct student stu[])
{float sum,aver;
int i,j;
for(i=0;i<N;i++)
{sum=0;
for(j=0;j<3;j++)
sum+=stu[i].score[j];
aver=sum/3.0;
stu[i].sum=sum;
stu[i].aver=aver;
}
printf("number name sum average \n");
for(i=0;i<N;i++)
printf("%-8s%-10s%-9.2f%-9.2f\n",stu[i].num,stu[i].name,stu[i].sum,stu[i].aver);
}

void sort(struct student stu[])
{int i,j,k;
struct student temp;
for(i=0;i<N;i++)
{k=i;
for(j=i+1;j<N;j++)
if(stu[k].sum<stu[j].sum)k=j;
if(k!=i)
{temp=stu[i];
stu[i]=stu[k];
stu[k]=temp;}
}
printf("number name score1 score2 score3 sum average \n");
for(i=0;i<N;i++)
printf("%-8s%-10s%-8.2f%-8.2f%-8.2f%-8.2f%-8.2f\n",stu[i].num,stu[i].name,stu[i].score[0],stu[i].score[1],stu[i].score[2],stu[i].sum,stu[i].aver);
}

void find(struct student stu[])
{int i,j,sum,flag=0;
printf("the student of two scores<60:\n");
for(i=0;i<N;i++)
{
sum=0;
for(j=0;j<3;j++)
if(stu[i].score[j]<60)sum++;
if(sum>=2)
{flag=1;
printf("%-8s%-10s\n",stu[i].num,stu[i].name);
}
}
if(flag==0)
printf(" not exist!\n");
}

G. C語言課程設計 設計題目管理系統

你好,源代碼,實現你所要求的,需要了就聊我

H. 求C語言課程設計(教務信息管理系統)

/*-------------1-------------*/
#include<bios.h>
#include<dos.h> /*頭文件*/
#include<conio.h>
#include<ctype.h>
#include<process.h>
#include<stdlib.h>
#include<stdio.h>
#include<string.h>

#define NULL 0
#define ESC 0x001b /* 退出 */
#define F1 0x3b00 /* 查看幫助信息,調用HelpMassage()函數 */
#define F2 0x3c00 /*輸入學生成績*/
#define F3 0x3d00 /*按學號查找*/
#define F4 0x3e00 /*按姓名查找*/
#define F5 0x3f00 /*列出所有學生成績*/
#define F6 0x4000 /*統計*/

struct stuType /*定義結構體變數*/
{
char NO[11]; /*學號長度為10*/
char XM[10];
char AGE[2]; /*年齡長度為2*/
float CJ[4]; /*包含4門成績*/
};

/*-------------2-------------*/
int JY_NO(char *stu_num,FILE *fp) /*檢驗學號的正確性*/
{ struct stuType stud;
int NO;
char *p=stu_num;
if(strcmp(stu_num,"#")==0) return 1; /*若輸入"#"返回真值,不再循環輸入*/
while(*p!='\0') /*學號必須是數字,否則返回重新輸入*/
{ NO=(int)*p;
if(NO<48||NO>57)
{ puts("\t\tUndefined SN!Please input again!\n");/*非法學號!請重新輸入!*/
return 0;
}
else p++; /*指針加1*/
}
if(strlen(stu_num)!=10) /*若學號長度不為10,則返回重新輸入*/
{ puts("\t\tLength of SN Error!\n");/*學號長度不對*/
return 0;
}
if(getchar()!='\n') /*若學號後面的字元不是回車符,則學號長度大於10*/
{ printf("\t\tThe length of SN should more than 10!Please input again!\n");/*學號長度大於10個,請重新輸入*/
do{}while(getchar()!='\n'); /*用getchar接收多餘的字元*/
return 0;
}

else
{
rewind(fp); /*使文件指針指向頭*/
while(!feof(fp)) /*若文件指針未到結尾,就繼續執行下面的循環,feof遇到文件結束符返回非零值,否則返回0*/
{ fread(&stud,sizeof(struct stuType),1,fp); /*讀取一定長度的數據*/
if(strcmp(stu_num,stud.NO)==0) /*學號的唯一性*/
{ printf("\t\t Repeat SN,Please input again!\n");/*學號重復!請重新輸入*/
printf("\t\tThe Record of this student:\n");/*該學生成績如下*/
printf("\t\tChinese:%.1f\n",stud.CJ[0]);/*語文*/
printf("\t\tMath:%.1f\n",stud.CJ[1]);/*數學*/
printf("\t\tEnglish:%.1f\n",stud.CJ[2]);/*英語*/
printf("\t\tTotal:%.1f\n",stud.CJ[3]);/*總評*/
return 0;
}
}
}
return 1;

}
/*-------------3-------------*/
int JY_NO2(char *stu_num) /*檢驗學號*/
{ int NO;
char *p=stu_num;
if(strcmp(stu_num,"#")==0)return 1; /*若輸入「#」,則返回真值結束*/
if(strlen(stu_num)!=10) /*學號長度不為10*/
{ puts("\t\tLength of SN Error!\n");/*學號長度不對*/
return 0;
}
while(*p!='\0') /*學號必須用數字,若包含有字母,或其它字元則返回假值重新輸入*/
{ NO=(int)*p;
if(NO<48||NO>57)
{ puts("\t\tUndefined SN!Please input again!\n");/*非法學號!請重新輸入*/
return 0;
}
else p++; /*指針加1*/
}
if(getchar()!='\n') /*檢驗學號長度是否大於10,並把多餘的字元去掉*/
{ printf("\t\tThe length of SN should more than 10!Please input again!\n");/*學號長度大於10個,請重新輸入*/
do{}while(getchar()!='\n');
return 0;
}
return 1;
}

/*-------------4-------------*/
int JY_XM(char *stu_XM) /*檢驗姓名*/
{ int PD;
char *p;
p=stu_XM;
while(*p!='\0') /*姓名只能用英文*/
{
PD=(int)*p;
if(PD<0)
{ puts("\t\tName should use English, Please input again!\n");/*姓名只能用英文請重新輸入*/
return 0;
}
else p++; /*使指針加1,指向下一漢字*/
}
if(getchar()!='\n') /*姓名長度不得大於5個*/
{ printf("\t\tThe length of Name is more than 5, Please input again!\n");/*姓名長度大於5個請重新輸入*/
do{}while(getchar()!='\n');
return 0;
}
return 1; /*字元串全為漢字返回真*/

}

/*-------------5-------------*/
int JY_AGE(float stu_AGE) /*年齡只能在0~100之間*/
{
if(stu_AGE<0||stu_AGE>100)
{ printf("\t\tInput Error! Record should between 0~100!\n");/*輸入錯誤,成績只能在0~100之間*/
return 0;
}
return 1;
}

/*-------------6-------------*/
int JY_CJ(float stu_CJ) /*學生成績只能在0~100之間*/
{
if(stu_CJ<0||stu_CJ>100)
{ printf("\t\tInput Error! Record should between 0~100!\n");/*輸入錯誤,成績只能在0~100之間*/
return 0;
}
return 1;
}

/*-------------7-------------*/
void CreatFile() /*輸入文件*/
{ FILE *fp;
struct stuType stu,stu0={"","",}; /*對stu0xianfu*/
fp=fopen("stu.dat","wb+"); /*打開或創建一個二進制文件,打開時將原來的內容刪除*/
if(fp==NULL)
{ printf("\t\tFile opens Error!\n\t\t\tPress Anykey back...");/*文件打開失敗,按任意鍵返回*/
getch();
return;
}
else
{ while(1)
{ stu=stu0;
do{ printf("\n\t\tPlease input SN:"); /*輸入學號並檢驗其正確性*/
scanf("%10s",stu.NO);
}while(!JY_NO(stu.NO,fp));
if(strcmp(stu.NO,"#")==0)break;
do{ printf("\n\t\tPlease input Name:"); /*輸入姓名並檢驗其正確性*/
scanf("%10s",stu.XM);
}while(!JY_XM(stu.XM));
do{ printf("\n\t\tPlease input age:"); /*輸入年齡績並檢驗其正確性*/
scanf("%f",&stu.AGE);
}while(!JY_AGE(stu.AGE[0]));
do{ printf("\n\t\tPlease input record of Chinese:"); /*輸入成績並檢驗其正確性*/
scanf("%f",&stu.CJ[0]);
}while(!JY_CJ(stu.CJ[0]));
do{ printf("\n\t\tPlease input record of Math:"); /*同上*/
scanf("%f",&stu.CJ[1]);
}while(!JY_CJ(stu.CJ[1]));
do{ printf("\n\t\tPlease input record of English:");
scanf("%f",&stu.CJ[2]);
}while(!JY_CJ(stu.CJ[2]));
do{ printf("\n\t\tPlease input record of Total:");
scanf("%f",&stu.CJ[3]);
}while(!JY_CJ(stu.CJ[3]));
fwrite(&stu,sizeof(struct stuType),1,fp); /*寫文件*/
}

}
fclose(fp); /*關閉文件*/

}

/*-------------8-------------*/
void Search_Xuehao() /*按學號查詢*/
{ FILE *fp;
int flag;
struct stuType stu,stud;
fp=fopen("stu.dat","rb");
if(fp==NULL) /*若文件打不開則輸出下面的信息*/
{ printf("\t\tFile opens Error!\n\t\t\tPress Anykey back...");
getch();
return;
}
else
{ do{ puts("\n\t\tPress\"#\" or search");
do{ printf("\t\tPlease input the SN what you want:");
scanf("%10s",stu.NO);
}while(!JY_NO2(stu.NO));
if(strcmp(stu.NO,"#")==0)break; /*若輸入「#」則結束循環*/
flag=0;
rewind(fp);
while(fread(&stud,sizeof(struct stuType),1,fp)) /*檢查文件指針結束*/
{ if(strcmp(stu.NO,stud.NO)==0) /*比較學號*/
{ puts("\t\tThe Record of this student:");
printf("\t\tSN:%s\n",stud.NO);
printf("\t\tName:%s\n",stud.XM);
printf("\t\tAGE:%.1f\n",stud.AGE[0]);
printf("\t\tChinese:%.1f\n",stud.CJ[0]);
printf("\t\tMath:%.1f\n",stud.CJ[1]);
printf("\t\tEnglish:%.1f\n",stud.CJ[2]);
printf("\t\tTotal:%.1f\n",stud.CJ[3]);
flag=1; /*記錄學號是否查到*/
}
}
if(flag==0)puts("\t\tUndefined SN");
}while(strcmp(stu.NO,"#")!=0);

}
fclose(fp); /*關閉文件*/

}

/*-------------9-------------*/
void Search_Xingming() /*按姓名查找*/
{ FILE *fp;
int flag=0;
struct stuType stu,stud;
fp=fopen("stu.dat","rb");
if(fp==NULL)
{ printf("\t\tFile opens Error!\n\t\tPress Anykey back...");
getch();
return;
}
else
{ do{
do{ printf("\t\tPlease input the Name of the Student what you want:");
scanf("%10s",stu.XM);
}while(!JY_XM(stu.XM));
rewind(fp); /*文件指針指向頭*/
while(fread(&stud,sizeof(struct stuType),1,fp))
{ if(strcmp(stu.XM,stud.XM)==0) /*比較姓名是否相同*/
{ puts("\t\tThe name of the Student is:");
printf("\t\tSN:%s\n",stud.NO);
printf("\t\tName:%s\n",stud.XM);
printf("\t\tAGE:%.1f\n",stud.AGE[0]);
printf("\t\tChinese:%.1f\n",stud.CJ[0]);
printf("\t\tMath:%.1f\n",stud.CJ[1]);
printf("\t\tEnglish:%.1f\n",stud.CJ[2]);
printf("\t\tTotal:%.1f\n",stud.CJ[3]);
flag=1; /*記錄姓名是否被查到*/
}
}
if(flag==0)puts("\n\t\tUndefined Name!");
puts("\t\tContinue?(y--yes,Else key back)?");
}while(getch()=='y');
}
fclose(fp);
/* puts("\t\tPress Anykey to continue...");*/
/* getch();*/

}

/*-------------10-------------*/
int ListFile(void) /*輸出文件,列出所有學生成績*/
{ FILE *fp;
int REC=0; /*記錄學生人數*/
struct stuType stu;
fp=fopen("stu.dat","rb");
if(fp==NULL)
{ printf("\t\tFile opens Error!\n\t\tPress Anykey back...");
getch();
return 1;
}
else{ printf("\t\tRecords of the Students:\n");
printf("\t\tSN\t\tName\tChinese\tMath\tEnglish\tTotal\n");
rewind(fp);
while(fread(&stu,sizeof(struct stuType),1,fp))
{ /*每讀取一個長度的數據就輸出*/
printf("\t\t%s",stu.NO);
printf("\t%s",stu.XM);
printf("\t%.1f",stu.AGE);
printf("\t%.1f",stu.CJ[0]);
printf("\t%.1f",stu.CJ[1]);
printf("\t%.1f",stu.CJ[2]);
printf("\t%.1f",stu.CJ[3]);
printf("\n");
REC++;
if(REC%20==0) /*20個學生成績,停一下*/
{ printf("\t\tPress Anykey to continue...\n");
getch();
}
}
}
fclose(fp); /*關閉文件*/
printf("\t\tContinue...");
getch();

}

/*-------------11-------------*/
void Statistics() /*統計及格和優秀人數*/
{ FILE *fp;
int REC=0,unpass[4]={0},good[4]={0}; /*REC--記錄個數,即人數,unpass--重修人數,good--優秀人數*/
float highest[4]={0},score[4]={0}; /*highest--最高分,score--總分*/

struct stuType stu;
fp=fopen("stu.dat","rb");
if(fp==NULL)
{ printf("\t\tFile opens Error!\n\t\tPress Anykey back...");
getch();
return;
}
else { rewind(fp);
while(fread(&stu,sizeof(struct stuType),1,fp))
{ REC++;
score[0]=score[0]+stu.CJ[0]; /*語文*/
if(stu.CJ[0]<=60)unpass[0]++;
if(stu.CJ[0]>=80)good[0]++;
if(highest[0]<stu.CJ[0])highest[0]=stu.CJ[0];
score[1]=score[1]+stu.CJ[1]; /*數學*/
if(stu.CJ[1]<=60)unpass[1]++;
if(stu.CJ[1]>=80)good[1]++;
if(highest[1]<stu.CJ[1])highest[1]=stu.CJ[1];
score[2]=score[2]+stu.CJ[2]; /*英語*/
if(stu.CJ[2]<=60)unpass[2]++;
if(stu.CJ[2]>=80)good[2]++;
if(highest[2]<stu.CJ[2])highest[2]=stu.CJ[2];
score[3]=score[3]+stu.CJ[3]; /*總評*/
if(stu.CJ[3]<=60)unpass[3]++;
if(stu.CJ[3]<=80)good[3]++;
if(highest[3]<stu.CJ[3])highest[3]=stu.CJ[3];
}
if(REC==0) /*可以防止記錄為0是REC作除數而造成的錯誤*/
{ printf("\t\tYou did't input the Name!Press Anykey back...");
getch();
return;
}
else{
printf("\t Chinese\t Math\t English\tTotal\n"); /*輸出統計信息*/
printf("\tAverage: %.1f\t %.1f\t %.1f\t\t%.1f\n",score[0]/REC,score[1]/REC,score[2]/REC,score[3]/REC);
printf("\tTop record: %.1f\t %.1f\t %.1f\t\t%.1f\n",highest[0],highest[1],highest[2],highest[3]);
printf("\tNumber of good students: %d\t\t %d\t %d\t\t %d\n",good[0],good[1],good[2],good[3]);
printf("\tNumber of unpassed students:%d\t\t %d\t %d\t\t %d\n",unpass[0],unpass[1],unpass[2],unpass[3]);
}
}
fclose(fp);
printf("\n\t\t\tPress Anykey to continue...");
getch();

}

/*-------------12-------------*/
void HelpMessage()
{ clrscr();
printf("\n\n\n\n\n chi xi tong shi lao shi suo bu zuoye bian ercheng,gai xitong juyou cunchu xuesheng shuju,an xuehao,xingming chaxun,liechu xuesheng chengji he tongjigongneng.\n \n shiyongfangfa:xitong shulu shuju hou,jiangzai dangqian muluzhong jianli yige mingwei stu.dat wenjian,yongyubaocun shulu de shuju.xuehao shulu neng yong shuzi shulu qie xuehao neng shi10wei.xingming shulu fuhe zhongguoren de xingming,neng yong zhongwen pinying,qie zuichangwei5 ge han.\n chi chenxu zai Turbo C2.0xia yunxing tongguo \n\n ");
getch();
}

/*-------------13-------------*/
int GetKey(void) /*此函數返回一個按鍵的數值*/
{ int key;
key=bioskey(0); /*bioskey為調用BIOS鍵盤介面*/
if(key<<8) /*位移*/
{
key=key&0x00ff;

}
return key; /*返回按鍵*/
}

/*-------------14-------------*/
void main()
{ int key;
struct date d; /*定義時間結構體*/
getdate(&d); /*讀取系統日期並把它放到結構體d中*/
clrscr(); /*清除屏幕*/
printf("\n\n\n\n\n");
printf("\t ========================================================\n"); /*版本信息*/
printf("\n");
printf("\t\t The System of Students Records Management 1.0 \n");
printf("\n");
printf("\n");
printf("\t\t Builder: XG042-WZM YS HYF WQ \n");
printf("\t\t Teacher:Song Zheyuan\n");
printf("\t\t Time:2005\\7\\5 \n");
printf("\n");
printf("\t ========================================================\n");
printf("\t\t\tPress Anykey to continue...");
/*while(!kbhit());*/
getch(); /*從鍵盤讀取一個字元,但不顯示於屏幕*/
system("cls"); /*調用DOS的清屏函數,TC中可用clrscr代替*/
while(1) /*主菜單*/
{
printf("\n\n\n\n\n");
printf("\t **************************************************\n");
printf("\t **\t **\n");
printf("\t **\tF1 --Help **\n");
printf("\t **\t **\n");
printf("\t **\tF2 --Data Input & Save **\n");
printf("\t **\t **\n");
printf("\t **\tF3 --Search by SN **\n");
printf("\t **\t **\n");
printf("\t **\tF4 --Search by Name **\n");
printf("\t **\t **\n");
printf("\t **\tF5 --Contents Input **\n");
printf("\t **\t **\n");
printf("\t **\tF6 --Count Students Number(Passed&Good) **\n");
printf("\t **\t **\n");
printf("\t **\tESC--Quit the System **\n");
printf("\t **\t **\n");
printf("\t **************************************************\n");
printf("\n\t Please select...\t\t%d\\%d\\%d\n\n",d.da_year,d.da_mon,d.da_day); /*提示信息,並顯示當前系統日期*/
key=GetKey(); /*調用自定義函數,讀取一個鍵*/
switch(key)
{
case F1: HelpMessage(); break;
case F2: CreatFile(); break;

case F3: Search_Xuehao(); break;
case F4: Search_Xingming();break;
case F5: ListFile(); break;
case F6: Statistics(); break;
case ESC:exit(1); break;
/*default: puts("\t\t\tWrong SN input!");
printf("\t\t\tPress Anykey back...");
getch();*/
}
clrscr(); /*每執行完一項功能後,自動清屏*/
}

}

熱點內容
武漢大學學生會輔導員寄語 發布:2021-03-16 21:44:16 瀏覽:612
七年級學生作文輔導學案 發布:2021-03-16 21:42:09 瀏覽:1
不屑弟高考成績 發布:2021-03-16 21:40:59 瀏覽:754
大學畢業證會有成績單 發布:2021-03-16 21:40:07 瀏覽:756
2017信陽學院輔導員招聘名單 發布:2021-03-16 21:40:02 瀏覽:800
查詢重慶2018中考成績查詢 發布:2021-03-16 21:39:58 瀏覽:21
結業考試成績怎麼查詢 發布:2021-03-16 21:28:40 瀏覽:679
14中醫醫師資格筆試考試成績查分 發布:2021-03-16 21:28:39 瀏覽:655
名著賞析課程標准 發布:2021-03-16 21:27:57 瀏覽:881
北京大學商業領袖高端培訓課程 發布:2021-03-16 21:27:41 瀏覽:919