调整了函数位置

This commit is contained in:
lsy2246 2024-01-02 21:12:58 +08:00
parent 5c698dfd37
commit b870b11f09
7 changed files with 370 additions and 202 deletions

View File

@ -13,6 +13,14 @@ struct Personal_Information//定义个人信息结构体变量
unsigned int course_number[20];//课程编号
};
struct Course//课程结构体
{
unsigned int id;
char name[20];
};
extern struct Course that_course;//当前课程
extern struct Personal_Information that_person;//当前的联系人
extern bool pick_revision;//判断文件有没有修改完成
extern bool pick_view_mode;//判断查看视图的模式

View File

@ -1,9 +1,6 @@
#ifndef FUNCTION_STATEMENT_PAGE_H //检查宏有没有被定义过
#define FUNCTION_STATEMENT_PAGE_H //定义宏
void system_start(void);//管理系统主页
void newly_built(void);//新增联系人页面
void print_view_mode1(void);//打印视图模式
void print_view_mode2(void);//打印列表模式
void system_start(void);//学生管理主页
void course_start(void);//课程管理主页
#endif //FUNCTION_STATEMENT_PAGE_H

View File

@ -21,9 +21,9 @@ static struct Snake
int tail[2];
};
struct Snake snake ;
static struct Snake snake ;
static void printf_main ( void )//主页菜单
static void main_printf_view ( void )//主页菜单
{
HideCursor ( );//隐藏光标
system ( "cls" );//清屏
@ -51,7 +51,7 @@ static void printf_main ( void )//主页菜单
color ( 1 );//设置颜色
printf ( "[M]" );
color ( 7 );//设置颜色
printf ( "\t 课程管理" );
printf ( "\t 管理课程" );
CursorJump ( 13 , 52 );
color ( 1 );//设置颜色
@ -73,7 +73,7 @@ static void printf_main ( void )//主页菜单
}
}
static void move_snake(void)//移动小蛇
static void main_move_snake(void)//移动小蛇
{
Sleep (80);
CursorJump ( snake.tail[0] , snake.tail[1] );
@ -106,7 +106,7 @@ static void move_snake(void)//移动小蛇
snake.body[1]=46;
snake.head[0]=6;
snake.head[1]=47;
printf_main();
main_printf_view();
}
color ( 13 );//设置颜色
CursorJump ( snake.tail[0] , snake.tail[1] );
@ -117,8 +117,6 @@ static void move_snake(void)//移动小蛇
printf ("");
}
//主函数
int main ( void )
{
@ -129,7 +127,7 @@ int main ( void )
srand ( ( unsigned ) time ( NULL ) );
while ( 1 )
{
move_snake();//移动小蛇
main_move_snake();//移动小蛇
//获取用户的输入
if ( _kbhit ( ) )
{
@ -150,7 +148,7 @@ int main ( void )
case 'M':
{
start_pick = '0';
system_start ( );//管理系统主页
course_start ( );//管理系统主页
snake.head[0]=7;
snake.head[1]=45;
break;

View File

@ -9,7 +9,29 @@
#include "function_statement_effect.h"//功能
static void printf_start_image ( void )//打印图像信息
static void course_print_view(void)//打印列表模式
{
//将原来的清空
for ( int i = 3 ; i < 28 ; ++ i )
{
for ( int j = 0 ; j < 100 ; ++ j )
{
CursorJump ( i , j );//位置跳转
printf (" ");
}
}
for ( int i = 4 ; i < 28 ; i+=2 )
{
for ( int j = 6 ; j < 92 ; j+=10 )
{
CursorJump ( i , j );//位置跳转
color (11);
printf ("%s",that_person.name);
}
}
}
static void course_printf_start_image ( void )//打印图像信息
{
//上边按键信息
system ( "cls" );//清屏
@ -18,31 +40,28 @@ static void printf_start_image ( void )//打印图像信息
color ( 14 );
printf ( "[ESC] " );
color ( 12 );
printf ( "退出 " );
printf ( "退出 " );
color ( 14 );
printf ( "[CTRL+Z] " );
color ( 12 );
printf ( "重新读档 " );
printf ( "重新读档 " );
color ( 14 );
printf ( "[CTRL+S] " );
color ( 12 );
printf ( "保存修改 " );
color ( 14 );
printf ( "[TAB] " );
color ( 12 );
printf ( "切换视图 " );
printf ( "保存修改 " );
color ( 14 );
printf ( "[WSAD/箭头键] " );
color ( 12 );
printf ( "移动选择 " );
printf ( "移动选择 " );
color ( 14 );
printf ( "[CTRL+A/D] " );
color ( 12 );
printf ( "翻页\n" );
//打印边界
printf ( "翻页" );
color ( 15 );
for ( int i = 0 ; i < 100 ; ++ i )//上面的
{
CursorJump ( 3 , i );//位置跳转
printf ( "" );
}
for ( int i = 0 ; i < 100 ; ++ i )//底部
@ -57,10 +76,10 @@ static void printf_start_image ( void )//打印图像信息
}
for ( int i = 101 ; i < 120 ; ++ i )//个人信息那里
{
CursorJump ( 5 , i );//位置跳转
CursorJump ( 4 , i );//位置跳转
printf ( "" );
}
CursorJump ( 6 , 104 );//位置跳转
CursorJump ( 5 , 104 );//位置跳转
color ( 13 );
printf ( "学生个人信息" );
CursorJump ( 28 , 45 );//位置跳转
@ -71,27 +90,22 @@ static void printf_start_image ( void )//打印图像信息
color ( 14 );
printf ( "[N]" );
color ( 12 );
printf ( " 新建学生" );
printf ( " 新建课程" );
CursorJump ( 1 , 101 );//位置跳转
color ( 14 );
printf ( "[F]" );
color ( 12 );
printf ( " 查找学生" );
printf ( " 查找课程" );
CursorJump ( 2 , 101 );//位置跳转
color ( 14 );
printf ( "[E]" );
color ( 12 );
printf ( " 编辑信息" );
printf ( " 编辑课程" );
CursorJump ( 3 , 101 );//位置跳转
color ( 14 );
printf ( "[Q]" );
color ( 12 );
printf ( " 查看成绩" );
CursorJump ( 4 , 101 );//位置跳转
color ( 14 );
printf ( "[Delete] " );
color ( 12 );
printf ( "删除学生" );
printf ( "删除课程" );
//底部信息
CursorJump ( 29 , 0 );//位置跳转
@ -100,36 +114,18 @@ static void printf_start_image ( void )//打印图像信息
if(pick_revision)
{
color(11);
printf("未修改\t");
printf("未修改\t\t\t ");
}
else
{
color(11);
printf("未保存\t");
printf("未保存\t\t\t ");
}
color(9);
printf ("学生总数:");
color(11);
printf("%d\t",Total);
if(pick_view_mode)
{
color(9);
printf ("视图模式:");
color(11);
printf("详细模式\t");
}
else
{
color(9);
printf ("视图模式:");
color(11);
printf("列表模式\t");
}
color(9);
printf ("选择编号:");
color(11);
printf("%d\t",that_person.id);
printf("%d\t\t\t\t\t",that_person.id);
color(9);
printf ("");
color(11);
@ -144,17 +140,11 @@ static void printf_start_image ( void )//打印图像信息
printf ( "当前时间为:%s\n" , asctime ( gmtime ( & now_time ) ) );
}
void system_start ( void )
void course_start(void)//课程管理主页
{
printf_start_image ( );//打印图像信息
if(pick_view_mode)//打印视图模式
{
print_view_mode1();//打印视图模式
}
else
{
print_view_mode2();//打印列表模式
}
course_printf_start_image ( );//打印图像信息
course_print_view();//打印列表模式
while ( 1 )
{
//更新时间
@ -181,25 +171,11 @@ void system_start ( void )
MessageBox(0,"修改未保存","警告",0);
}
}
else if(tmp_input ==TAB)
{
if(pick_view_mode)//打印视图模式
{
pick_view_mode=false;
print_view_mode1();//打印视图模式
}
else
{
pick_view_mode=true;
print_view_mode2();//打印列表模式
}
}
else if(tmp_input=='N'||tmp_input=='n')
{
newly_built();//新增联系人页面
//新增联系人页面
}
}
}
}

View File

@ -0,0 +1,309 @@
//头文件
#include <stdio.h>
#include <windows.h>
#include <conio.h>
#include <time.h>
//自定义头文件
#include "founction_statement_page.h"//界面
#include "function_statement_effect.h"//功能
//临时全局变量
struct Personal_Information that_person = {1, "lsy", true, 2023150, 1, 2020, "18888888888", {1, 2, 3}};
void system_print_view_mode1(void)//打印视图模式
{
//将原来的清空
for ( int i = 3 ; i < 28 ; ++ i )
{
for ( int j = 0 ; j < 100 ; ++ j )
{
CursorJump ( i , j );//位置跳转
printf (" ");
}
}
//打印
CursorJump ( 3 , 0 );//位置跳转
color(7);
printf ("编号 ");
printf ("姓名\t");
printf ("性别 ");
printf ("学号\t");
printf ("班级\t");
printf ("入学年份 ");
printf ("手机号码\t");
printf ("选课编号");
for ( int i = 5 ; i < 27 ; i+=2 )
{
//编号
CursorJump ( i , 0 );//位置跳转
color (10);
printf ("%d ",that_person.id);
//姓名
CursorJump ( i , 6 );//位置跳转
color (13);
printf ("%s",that_person.name);
//性别
CursorJump ( i , 16 );//位置跳转
if(that_person.sex)
{
color (11);
printf ("");
}
else
{
color (12);
printf ("");
}
//学号
CursorJump ( i , 22 );//位置跳转
color (9);
printf ("%d",that_person.student_id);
//班级
CursorJump ( i , 32 );//位置跳转
color (14);
printf ("%d班",that_person.class);
//入学年份
CursorJump ( i , 40 );//位置跳转
color (9);
printf ("%d年",that_person.year);
//电话号码
CursorJump ( i , 50 );//位置跳转
color (15);
printf ("%s",that_person.phone);
CursorJump ( i , 64 );//位置跳转
for ( int j = 0 ; that_person.course_number[j] != '\0' ; ++ j )
{
if(j>0)
{
color (12);
printf (",");
}
color (11);
printf ("%d",that_person.course_number[j]);
}
}
}
void system_print_view_mode2(void)//打印列表模式
{
//将原来的清空
for ( int i = 3 ; i < 28 ; ++ i )
{
for ( int j = 0 ; j < 100 ; ++ j )
{
CursorJump ( i , j );//位置跳转
printf (" ");
}
}
for ( int i = 4 ; i < 28 ; i+=2 )
{
for ( int j = 6 ; j < 92 ; j+=10 )
{
CursorJump ( i , j );//位置跳转
color (11);
printf ("%s",that_person.name);
}
}
}
static void system_printf_start_image ( void )//打印图像信息
{
//上边按键信息
system ( "cls" );//清屏
color ( 10 );
printf ( "\t\t\t学生管理\n" );
color ( 14 );
printf ( "[ESC] " );
color ( 12 );
printf ( "退出 " );
color ( 14 );
printf ( "[CTRL+Z] " );
color ( 12 );
printf ( "重新读档 " );
color ( 14 );
printf ( "[CTRL+S] " );
color ( 12 );
printf ( "保存修改 " );
color ( 14 );
printf ( "[TAB] " );
color ( 12 );
printf ( "切换视图 " );
color ( 14 );
printf ( "[WSAD/箭头键] " );
color ( 12 );
printf ( "移动选择 " );
color ( 14 );
printf ( "[CTRL+A/D] " );
color ( 12 );
printf ( "翻页\n" );
//打印边界
color ( 15 );
for ( int i = 0 ; i < 100 ; ++ i )//上面的
{
printf ( "" );
}
for ( int i = 0 ; i < 100 ; ++ i )//底部
{
CursorJump ( 28 , i );//位置跳转
printf ( "" );
}
for ( int i = 0 ; i < 30 ; ++ i )
{
CursorJump ( i , 100 );//位置跳转
printf ( "|" );
}
for ( int i = 101 ; i < 120 ; ++ i )//个人信息那里
{
CursorJump ( 5 , i );//位置跳转
printf ( "" );
}
CursorJump ( 6 , 104 );//位置跳转
color ( 13 );
printf ( "学生个人信息" );
CursorJump ( 28 , 45 );//位置跳转
color ( 13 );
printf ( "状态栏" );
//打印右边按键信息
CursorJump ( 0 , 101 );//位置跳转
color ( 14 );
printf ( "[N]" );
color ( 12 );
printf ( " 新建学生" );
CursorJump ( 1 , 101 );//位置跳转
color ( 14 );
printf ( "[F]" );
color ( 12 );
printf ( " 查找学生" );
CursorJump ( 2 , 101 );//位置跳转
color ( 14 );
printf ( "[E]" );
color ( 12 );
printf ( " 编辑信息" );
CursorJump ( 3 , 101 );//位置跳转
color ( 14 );
printf ( "[Q]" );
color ( 12 );
printf ( " 查看成绩" );
CursorJump ( 4 , 101 );//位置跳转
color ( 14 );
printf ( "[Delete] " );
color ( 12 );
printf ( "删除学生" );
//底部信息
CursorJump ( 29 , 0 );//位置跳转
color(9);
printf (" 当前状态:");
if(pick_revision)
{
color(11);
printf("未修改\t");
}
else
{
color(11);
printf("未保存\t");
}
color(9);
printf ("学生总数:");
color(11);
printf("%d\t",Total);
if(pick_view_mode)
{
color(9);
printf ("视图模式:");
color(11);
printf("详细模式\t");
}
else
{
color(9);
printf ("视图模式:");
color(11);
printf("列表模式\t");
}
color(9);
printf ("选择编号:");
color(11);
printf("%d\t",that_person.id);
color(9);
printf ("");
color(11);
printf("%d/%d",that_person.id%10,Total%10);
color(9);
printf ("");
//打印时间
color ( 11 );
CursorJump ( 0 , 50 );//位置跳转
time_t now_time;
time ( & now_time );
printf ( "当前时间为:%s\n" , asctime ( gmtime ( & now_time ) ) );
}
void system_newly_built(void)
{
//
}//新建联系人
void system_start ( void )//学生管理主页
{
system_printf_start_image ( );//打印图像信息
if(pick_view_mode)//打印视图模式
{
system_print_view_mode1();//打印视图模式
}
else
{
system_print_view_mode2();//打印列表模式
}
while ( 1 )
{
//更新时间
color ( 11 );
CursorJump ( 0 , 50 );//位置跳转
time_t now_time;
time ( & now_time );
printf ( "当前时间为:%s\n" , asctime ( gmtime ( & now_time ) ) );
//接收用户输入
if ( _kbhit ( ) )
{
static char tmp_input;//临时接收输入
tmp_input=(char)_getch();//接收用户的输入
if(tmp_input==ESC)
{
if(pick_revision)
{
return;
}
else
{
MessageBox(0,"修改未保存","警告",0);
}
}
else if(tmp_input ==TAB)
{
if(pick_view_mode)//打印视图模式
{
pick_view_mode=false;
system_print_view_mode1();//打印视图模式
}
else
{
pick_view_mode=true;
system_print_view_mode2();//打印列表模式
}
}
else if(tmp_input=='N'||tmp_input=='n')
{
system_newly_built();//新增联系人页面
}
}
}
}

View File

@ -1,13 +0,0 @@
//头文件
#include <stdio.h>
#include <windows.h>
#include <conio.h>
#include <time.h>
//自定义头文件
#include "function_statement_effect.h"//功能
void newly_built(void)
{
//
}

View File

@ -1,107 +0,0 @@
//头文件
#include <stdio.h>
#include <windows.h>
#include <conio.h>
#include <time.h>
//自定义头文件
#include "founction_statement_page.h"//界面
#include "function_statement_effect.h"//功能
struct Personal_Information that_person={1,"梁师谊",true,2023150,1,2020,"18888888888",{1,2,3}};//当前的联系人
void print_view_mode1(void)//打印视图模式
{
//将原来的清空
for ( int i = 3 ; i < 28 ; ++ i )
{
for ( int j = 0 ; j < 100 ; ++ j )
{
CursorJump ( i , j );//位置跳转
printf (" ");
}
}
//打印
CursorJump ( 3 , 0 );//位置跳转
color(7);
printf ("编号 ");
printf ("姓名\t");
printf ("性别 ");
printf ("学号\t");
printf ("班级\t");
printf ("入学年份 ");
printf ("手机号码\t");
printf ("选课编号");
for ( int i = 5 ; i < 27 ; i+=2 )
{
//编号
CursorJump ( i , 0 );//位置跳转
color (10);
printf ("%d ",that_person.id);
//姓名
CursorJump ( i , 6 );//位置跳转
color (13);
printf ("%s",that_person.name);
//性别
CursorJump ( i , 16 );//位置跳转
if(that_person.sex)
{
color (11);
printf ("");
}
else
{
color (12);
printf ("");
}
//学号
CursorJump ( i , 22 );//位置跳转
color (9);
printf ("%d",that_person.student_id);
//班级
CursorJump ( i , 32 );//位置跳转
color (14);
printf ("%d班",that_person.class);
//入学年份
CursorJump ( i , 40 );//位置跳转
color (9);
printf ("%d年",that_person.year);
//电话号码
CursorJump ( i , 50 );//位置跳转
color (15);
printf ("%s",that_person.phone);
CursorJump ( i , 64 );//位置跳转
for ( int j = 0 ; that_person.course_number[j] != '\0' ; ++ j )
{
if(j>0)
{
color (12);
printf (",");
}
color (11);
printf ("%d",that_person.course_number[j]);
}
}
}
void print_view_mode2(void)//打印列表模式
{
//将原来的清空
for ( int i = 3 ; i < 28 ; ++ i )
{
for ( int j = 0 ; j < 100 ; ++ j )
{
CursorJump ( i , j );//位置跳转
printf (" ");
}
}
for ( int i = 4 ; i < 28 ; i+=2 )
{
for ( int j = 6 ; j < 92 ; j+=10 )
{
CursorJump ( i , j );//位置跳转
color (11);
printf ("%s",that_person.name);
}
}
}