C语言入门 - 学生信息管理系统源码

学习C语言的一些疑问:

 win32application与win32 console application区别何在?

一、结构体的使用:

struct student
{
    char xuehao[11];
    char xingming[21];
    char gender[10];
    char home[100];
    char mingzu[21];
    int  age;
    
};

#define N 100

struct student stu [N];//将结构体student名字改为stu,且为结构体数组

结构体应用:stu[i].age

结构体数组实例:

/*****************

结构体数组


计算一个班学生四门课程平均分

************************/


#include 

typedef struct date
{
    int year;
    int month;
    int day;
}DATE;

typedef struct student
{
    long studentID;
    char studentName[10];
    char studentSex;
    DATE birthday;
    int score[4];
}STUDENT;

int main()
{
    int i,j,sum[30];
    STUDENT stu[30] = {{1001,"张三",'M',{1994,6,19},{72,32,89,41}},
        {1002,"赵六",'F',{1998,6,19},{72,56,78,41}},
        {1003,"王五",'M',{2004,6,19},{96,52,89,41}},
        {1004,"李四",'F',{1689,6,19},{56,56,65,41}}    
    };
    for(i=0;i<4;i++)
    {
        sum[i] = 0;
        for(j=0;j<4;j++)
        {
            sum[i] = sum[i] + stu[i].score[j];
        }
        printf("%10ld %8s %3c %6d/%02d/%02d %4d %4d %4d %4d %6.1f\n",
        stu[i].studentID,
        stu[i].studentName,
        stu[i].studentSex,
        stu[i].birthday.year,
        stu[i].birthday.month,
        stu[i].birthday.day,
        stu[i].score[0],
        stu[i].score[1],
        stu[i].score[2],
        stu[i].score[3],
        sum[i]/4.0);
    }
    return 0;
}

二、!strcmp(stu[2].age,age2)//age2与stu[2].age作比较;判断是否相等!

三、switch使用

四、#include

system("cls");//清屏

#include

getch();//从控制台读取一个字符,但不显示在屏幕上!原型:int getch()

 

 

学生信息管理源代码:

#include
#include
#include
#include//int getch();//任意键返回

int flag=0;	//标记


struct password1
{
	char password1[20];

}password1;

struct password2
{
	char password2[20];

}password2;
struct password3
{
	char password3[20];

}password3;

struct student//
{
	char xuehao[11];
	char xingming[21];
	char gender[10];
	char home[100];
	char mingzu[21];
	int  age;
	
};
struct studentnumber{
		
	int number;//录入学生的人数
}n;
#define N 100
struct student stu[N];

struct studentnumber2{
		
	int number2;//增加录入学生的人数
}n2;


void homepage();//主页函数声明
void studentinformation();
void information();
void lrinformation();//录入信息
void cxinfrmation();//查询信息
void xginformation();//修改信息
void llinformation();//浏览信息
void scinformation();//删除信息
void zjinformation();//增加信息

void studentresult();//学生成绩管理

/***************************************主页****************************************/
void homepage()//主页
{	
	int k;//


	system("cls");//清屏
	
	printf(" !!!========学生信息管理系统=========!!!\n");
	printf("********************************************\n");
	printf("********************************************\n");
	printf("**	1. 学生管理	5. 财务管理	  **\n");
	printf("**	2. 教务管理	6. 图书管理       **\n");
	printf("**	3. 科研管理	7. 设备管理       **\n");
	printf("**	4. 人事管理	8. 后勤管理	  **\n");
	printf("**	9. 办公室管理	10. 教师管理      **\n");
	printf("*******0. 退出******************************\n");
	printf("********************************************\n");

	printf("请您在上述功能中选择序号: ");


	scanf("%d",&k);

	switch(k)
	{

	case 1:
		studentinformation();
		homepage();
		break;

	case 2:
		system("cls");
		printf("敬请期待中!\n任意键返回主页面!\n");

		getch();//任意键返回,包含在头文件conio.h
		//Sleep(2000);
		homepage();
		break;

	case 3:
		system("cls");
		printf("敬请期待中!\n任意键返回主页面!\n");

		getch();//任意键返回
		Sleep(2000);
		homepage();
		break;

	case 4:
		system("cls");
		printf("敬请期待中!\n任意键返回主页面!\n");

		getch();//任意键返回
		Sleep(2000);
		homepage();
		break;

	case 5:
		system("cls");
		printf("敬请期待中!\n任意键返回主页面!\n");

		//getch();//任意键返回
		Sleep(2000);
		homepage();
		break;

	case 6:
		system("cls");
		printf("敬请期待中!\n任意键返回主页面!\n");

		//getch();//任意键返回
		Sleep(2000);
		homepage();
		break;

	case 7:
		system("cls");
		printf("敬请期待中!\n任意键返回主页面!\n");

		//getch();//任意键返回
		Sleep(2000);
		homepage();
		break;

	case 0:

		exit(0);//退出

		break;

	default :

		system("cls");
		printf("您的选择错误!任意键返回主页!\n");	
	    getch();
		Sleep(2000);
		homepage();
		break;

	}
	
	
}

/***************************************学生信息管理****************************************/
void studentinformation()
{

		 int i;

		 system("cls");

		 printf("*********************************************************************\n");
		 printf("	1. 学生个人信息管理模块		2. 学生个人成绩管理模块\n");
	     printf("		11.返回主页		0.退出系统\n");
		 printf("*********************************************************************\n");

		 scanf("%d",&i);

			switch(i)
			{	
			case 1:
				information();//
				break;
			case 11:
				homepage();
				break;
			/*case 0:
				exit(0);
				break;*/
			case 2:
				studentresult();//
				break;
			default:
					
					system("cls");
                	printf("您的选择错误!任意键重新选择!\n");	
					getch();//
					studentinformation();
					break;
			
			}
		
}

/***************************************学生个人信息管理模块****************************************/

void information(){

		int o;
		system("cls");
		printf("*********************************************************************\n");

				printf("	1.录入学生信息	3.查询学生信息\n");
				printf("	2.修改学生信息	4.浏览学生信息\n");
				printf("	5.删除学生信息	6.增加学生信息\n");
				printf("	    	  222.返回上一级\n");
				printf("	111.返回主页	0.退出系统	\n");

				printf("*********************************************************************\n");
				scanf("%d",&o);

				switch (o)
				{
				case 1:

					lrinformation();
					information();
					break;
				case 3:

					cxinfrmation();
					information();
					break;
				case 2:

					xginformation();
					information();
					break;
				case 4:

					llinformation();
					information();
					break;
				case 5:
					scinformation();
					information();
					break;
				case 6:

					zjinformation();
					information();
					break;
				case 222:

					studentinformation();

					break;

				/*case 0:

					exit(0);
					break;*/

				case 111:
					homepage();
					break;

				default :

					system("cls");				
					printf("您的选择错误!任意键重新选择!\n");	
					getch();
					information();
					break;
				}
			}
/***************************************录入信息****************************************/


void lrinformation()
{
				int i;
				system("cls");

				printf("请输入您要录入的学生人数");
				scanf("%d",&n.number );

				for(i=0;i

 

 

你可能感兴趣的:(C语言)