资源简介
基于C语言的控制台界面的简单的学生学分管理系统
代码片段和文件信息
// Implement.cpp 文件
//
#include “Declare.h“
#include
#include
#include
#include
#include
#include
#include
/*
** 显示主菜单
** 1. create list
** 2. display all record
** 3. insert a record
** 4. delete a record
** 5. query
** 6. add records from a text file
** 7. write to a text file
** 0. quit
** give your choice(0~7):
*/
void ShowMainMenu()
{
printf(“\n\n\n“);
printf(“\t\t**************** Menu ******************\n“);
printf(“\t\t*\t\t\t\t\t *\n“);
printf(“\t\t*\t1. create list\t\t\t *\n“);
printf(“\t\t*\t2. display all record\t\t *\n“);
printf(“\t\t*\t3. insert a record\t\t *\n“);
printf(“\t\t*\t4. delete a record\t\t *\n“);
printf(“\t\t*\t5. query\t\t\t *\n“);
printf(“\t\t*\t6. add records from a text file *\n“);
printf(“\t\t*\t7. write to a text file\t *\n“);
printf(“\t\t*\t8. reverse List\t\t *\n“);
printf(“\t\t*\t9. delete the same record\t *\n“);
printf(“\t\t*\t0. quit\t\t\t *\n“);
printf(“\t\t*\t\t\t\t\t *\n“);
printf(“\t\t******************************************\n“);
printf(“\t\tgive your choice (0~9):“);
}
/*
** 主控制流程:控制整个程序的运行
*/
void MainControl(StuNode *pHead)
{
// 刷屏
system(“cls“);
ShowMainMenu();
char userChoose;
do
{
userChoose = getchar();
getchar();
if(userChoose >= ‘0‘ && userChoose <= ‘9‘)
{
break;
}else{
printf(“\n\tPut errorplease put number between 0 and 9:“);
}
}while(true);
switch(userChoose)
{
case ‘1‘:
{
// 创建新表,如果表已经存在,则不创建
if(pHead != NULL)
{
system(“cls“);
printf(“\n\n\n\tList already existscan not create a new list!\n“);
printf(“\n\tpress any key to go back main menu...“);
_getch();
MainControl(pHead);
}
else
{
system(“cls“);
pHead = ::Create();
if(pHead == NULL)
{
printf(“List create failed.“);
return ;
}
printf(“\n\n\n\n\t\tCreate succeed!\n“);
printf(“\t\tpress any key to go back main menu...“);
_getch();
MainControl(pHead);
}
}
break;
case ‘2‘:
{
system(“cls“);
// 显示所有记录
if(pHead == NULL)
{
printf(“\n\n\n\n\t\tYou have not create listyou must create one first!\n“);
printf(“\t\tpress any key to go back main menu...“);
_getch();
}
else
{
::Display(pHead);
}
::MainControl(pHead);
}
break;
case ‘3‘:
{
system(“cls“);
// 插入一条记录
if(pHead == NULL)
{
printf(“\n\n\n\n\t\tYou have not create listyou must create one first!\n“);
printf(“\t\tpress any key to go back main menu...“);
_getch();
}
else
{
char name[256];
float score = 0.0f;
char mark;
do
{
printf(“Please input name and score(use blank split them):\n“);
scanf(“%s %f“name&score);
// printf(“%s%f\n“namescore);
Insert_A_Record(pHeadnamescore);
printf(“continue(‘Y‘ or ‘y‘
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 577 2010-05-26 10:36 Student_Score_Manage_System\Student_Score_Manage_System.dsw
文件 148480 2010-05-26 12:52 Student_Score_Manage_System\Debug\vc60.idb
文件 77824 2010-05-26 12:52 Student_Score_Manage_System\Debug\vc60.pdb
文件 582656 2010-05-26 12:52 Student_Score_Manage_System\Debug\Student_Score_Manage_System.pdb
文件 229461 2010-05-26 12:52 Student_Score_Manage_System\Debug\Student_Score_Manage_System.exe
文件 0 2010-05-26 12:52 Student_Score_Manage_System\Debug\Implement.sbr
文件 0 2010-05-26 12:34 Student_Score_Manage_System\Debug\main.sbr
文件 316336 2010-05-26 12:52 Student_Score_Manage_System\Debug\Student_Score_Manage_System.ilk
文件 1973 2010-05-26 12:34 Student_Score_Manage_System\Debug\main.obj
文件 2900992 2010-05-26 12:52 Student_Score_Manage_System\Debug\Student_Score_Manage_System.bsc
文件 4492372 2010-05-26 12:41 Student_Score_Manage_System\Debug\Student_Score_Manage_System.pch
文件 40959 2010-05-26 12:52 Student_Score_Manage_System\Debug\Implement.obj
文件 416 2010-05-26 12:51 Student_Score_Manage_System\indata.txt
文件 1119 2010-05-26 12:52 Student_Score_Manage_System\Student_Score_Manage_System.plg
文件 33792 2010-05-26 12:55 Student_Score_Manage_System\Student_Score_Manage_System.ncb
文件 1376 2010-05-26 11:44 Student_Score_Manage_System\outdata.txt
文件 1015 2010-05-26 12:22 Student_Score_Manage_System\Declare.h
文件 12947 2010-05-26 12:52 Student_Score_Manage_System\Implement.cpp
文件 391 2010-05-26 12:55 Student_Score_Manage_System\main.cpp
文件 49664 2010-05-26 12:55 Student_Score_Manage_System\Student_Score_Manage_System.opt
文件 4639 2010-05-26 12:55 Student_Score_Manage_System\Student_Score_Manage_System.dsp
目录 0 2010-05-26 10:36 Student_Score_Manage_System\Debug
目录 0 2010-05-26 10:36 Student_Score_Manage_System
----------- --------- ---------- ----- ----
8896989 23
评论
共有 条评论