資源簡介
這個是我學完C語言后花了近一個月時間做的。
實現用戶登陸,學號自動生成,學生信息輸入,排序,查詢,打印,保存到文件,從文件讀取,打印報表,退出等功能。。我想這個對需要的人應該有用
實現用戶登陸,學號自動生成,學生信息輸入,排序,查詢,打印,保存到文件,從文件讀取,打印報表,退出等功能。。我想這個對需要的人應該有用
代碼片段和文件信息
#include?
#include?
#include?
#include?
#include?
#include?
#include?
int?count=0tb=0; //全局變量。count是錄入學生信息的數量;tb是記錄保存的標志位;
?typedef?struct?student
{
char?num[4];
char?name[21];
int?age;
float?chinese;
float?math;
float?english;
float?physics;
float?chemistry;
float?total;
float?avg;
}stu;
?stu?men[100]={{“0““chen“00.0F0.0F0.0F0.0F0.0F0.0F0.0F}};
void?line(); //邊框函數;
float?ChengJi(int?xint?ychar?str[]); //成績錄入函數;
void?GuangBiao(int?int); //光標定位函數;
int?Name(int?xint?ychar?str[]int?len); //控制姓名輸入函數;
int?Age(int?xint?ychar?str[]int?len); //控制年齡輸入的函數;
int?Score(int?xint?ychar?str[]int?len); //控制分數輸入的函數;
void?Remove(char?str[]); //去除左右空格函數;
void?IDkey(); //登陸模塊;
void?Menu(); //主菜單函數;
void?AddStudent(); //添加模塊;
void?Addinfo(); //添加數據的界面;
void?PrintPicture(); //打印界面;
void?Printpage(stu?str[]int?int?); //打印函數;
void?Print(stu?str[]?int?); //打印模塊;
void?Sore(); //排序模塊;
void?Search(); //查詢模塊;
int?FileName(int?xint?ychar?str[]int?len); //控制文件名輸入函數;
void?Save(); //保存到文件模塊;
void?Load(); //從文件讀取數據模塊;
void?Statescore(); //打印報表模塊;
void?Exit_1(); //退出模塊;
int?Get(int?int?char?*?int?); //定長函數;
void?main()
{??
// IDkey();
for?(;;)
{
Menu();
}
}
//邊線邊框
void?line()
{???
int?i=0;
GuangBiao(00);
printf(“%c“201);
for(i=1;i<79;i++)
{
printf(“%c“205);
}
printf(“%c“187);
GuangBiao(023);
printf(“%c“200);
for(i=1;i<79;i++)
{
printf(“%c“205);
}
printf(“%c“188);
for(i=1;i<23;i++)
{
GuangBiao(0i);
printf(“%c“186);
GuangBiao(79i);
printf(“%c“186);
}
GuangBiao(019);
printf(“%c“204);
for(i=1;i<79;i++)
{
printf(“%c“205);
}
printf(“%c“185);
GuangBiao(3219);
printf(“\tmessage\t\t“);
}
void?GuangBiao(int?Xint?Y) //光標定位函數;
{
HANDLE?hwnd;
COORD??rd;
rd.X?=?X;
rd.Y?=?Y;
hwnd?=?GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleCursorPosition(hwndrd);
}
//定長函數;
int?Get(int?xint?ychar?str[]int?len)
{
int?i=0;
char?ch=‘\0‘;
do
{
GuangBiao(xy);
ch=getch();
if(ch?==?‘?‘)
{
continue;
}
if(ch==‘\b‘)
{
if(i!=0)
{
x--;
i--;
GuangBiao(xy);
putchar(‘?‘);
}
continue;
}
if(i==len-1)
{
continue;
}
if(isprint(ch))
{
str[i]=ch;
if(len?==?7)
{
putchar(‘*‘);
i++;
x++;
}
else
{
putchar(str[i]);
i++;
x++;
}
}
if?(ch==‘\r‘&&i==0)
{
GuangBiao(221);
printf(“can‘t??be??null!“);
getch();
GuangBiao(221);
printf(“????????????????????????“);
continue;
}
}while(ch!=‘\r‘||i==0);
str[i]=‘\0‘;
return?i;
}
//錄入界面;
void?AddStudent()
{
int?k=1bit=0lenm=0xuehaoj;
float?temp=0.0;
char?ch=‘0‘; //用來判斷是否繼續錄入;
char?str0[5]=“0“str1[4]=“0“;
char?stage[3]=“0“stchin[5]=“0“stmath[5]=“0“steng[5]
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件??????32818??2008-11-27?15:07??學生信息管理系統\080410.c
?????文件?????????24??2008-12-04?00:38??學生信息管理系統\用戶名和密碼.txt
?????目錄??????????0??2008-12-04?00:38??學生信息管理系統
-----------?---------??----------?-----??----
????????????????32842????????????????????3
評論
共有 條評論