㈠ c语言中学生信息的录入功能
1。根据学生信息定义一个结构体类型,再说明一个该结构体类型的数组。*/
struct stu_info{      
       char stuNo[10];/* No */      
       char stuName[30];/* Name */      
       float stuScore[3];/* the three scores */     
       float aveScore; /* average score */       
       float totalScore; /* total score */    
}stu[10];
/*  2。用input函数从键盘上输入10个学生的数据。 */
void  input()
{      int i = 0;     
       printf("Input the students' infomation(FORMAT LIKE:No Name score1 score2 score3):\n");      
       while(i < 10)
       {    printf("Input %d:",i + 1);      
            scanf("%s%s%f%f%f",stu[i].stuNo,stu[i].stuName,&stu[i].stuScore[0],&stu[i].stuScore[1],&stu[i].stuScore[2]);         
            i++;    
       }   
}
㈡ 求用C语言怎么实现学生信息录入功能
* 1。根据学生信息定义一个结构体类型,再说明一个该结构体类型的数组。*/
struct stu_info{      
       char stuNo[10];/* No */      
       char stuName[30];/* Name */      
       float stuScore[3];/* the three scores */     
       float aveScore; /* average score */       
       float totalScore; /* total score */    
}stu[10];
/*  2。用input函数从键盘上输入10个学生的数据。 */
void  input()
{      int i = 0;     
       printf("Input the students' infomation(FORMAT LIKE:No Name score1 score2 score3):\n");      
       while(i < 10)
       {    printf("Input %d:",i + 1);      
            scanf("%s%s%f%f%f",stu[i].stuNo,stu[i].stuName,&stu[i].stuScore[0],&stu[i].stuScore[1],&stu[i].stuScore[2]);         
            i++;    
       }   
}
㈢ c语言程序设计学生信息管理系统中如何插入学生信息
真有点累人啊,汗~~~~~~
不过,你的要求这些代码都能满足了,
可能会有点小错误,我这儿也无法验证,总之总体的思路是完全正确的。
#include <stdio.h>
#include <string.h>     //字符串头文件
#include <windows.h>   //Sleep函数的头文件
#include <conio.h>    //getch函数的头文件
#define N 50
//定义全局变量
//定义学员结构体
typedef struct Student
{
   
   char name[10];//姓名
   int NO;//学号
   char sex[10];//性别
   char subject[20];//专业
   int phone;//电话
   char jianli[200];//简历	
}STU;
    //声明这种学员类型的数组
    STU stu[N];
    //计数器n 
    int n=0; //代表数组的实际人数
//登录函数
void login()
{
	system("color 2A");//定义背景和前景颜色
	//登录模块实现代码
	char Yonghu[30];
    char Mima[30];
	for(int i=0;i<3;i++)
	{
	   // 打印登陆界面
		Sleep(500);//定时打印
		printf("\n\n\t\t\t\t学员管理系统平台\n");
	   		
		Sleep(500);
		
		printf("\n\t\t\n");
		Sleep(500);
	    printf("\n\t\t\t\t用户名:");
		gets(Yonghu);
		printf("\n\t\t\t\t密码:");
		char let=NULL;//定义一个字符变量为空值
		int j=0; //代表密码的实际长度
		while(j<10 && let!=13)//定义密码长度和当接收的字符不为回车键(回车键的ASCLL码值为13)时
		{
			let=getch();//获得字符 不显示
			if(let!=8)//当接收的字符不为退格键(退格键的ASCLL码值为8)时
			{
				Mima[j++]=let;//将接收的字符赋给数组Mima并自加一个长度
				printf("*");
			}
			else
			{
				if(j>0)//当密码长度不为0时
				{
					//删除字符的操作
					putchar(8);
					putchar(' ');
					putchar(8);
					Mima[--j]=NULL;//将空值赋给数组Mima并自减一个长度
				}
			}
		}
		Mima[--j]=NULL;
		putchar(8);//消除因回车键所打印的*
		putchar(' ');
		putchar(8);
		putchar('\0');//字符串结束标记
		//验证密码
        if(strcmp(Yonghu,"姓名")==0 && strcmp(Mima,"123456")==0)//用比较函数判断用户输入的用户名和密码是否正确
		{
			//调用dos命令清空控制台屏幕
			system("cls");
			printf("\n\n\n\n\n\t\t\t正在登录菜单界面,请稍候...");
			for(int i=0;i<=5;i++)
			{
				Sleep(666);
				printf(">>>");
			}
			for(int i=0;i<=100;i++)
			{
				system("cls");
				//%%为百分号
				printf("\n\n\n\n\n\n\n\t\t\t\t正在加载数据中...%d%%",i);	
			}
			system("cls");
			printf("\n\n\n\n\n\n\n\t\t\t\t加载数据成功,loding.....\n");
		    break;//跳出for循环
		}
		else 
		{
		    if(i<2)//用户输入错误不超过2次
		    {
				system("cls");
				printf("\n\n\n\n\n\n\n\n\n\n");
				Sleep(1000);
		        printf("\t:抱歉,您输入的用户名或密码错误,请重新输入!\n");
		    }
			else//用户3次输入都错误时
			{
				system("cls");
				printf("\n\n\n\n\n\n\n\n\n\n");
				Sleep(1000);
				printf("\t:Sorry,您输入的用户名或密码错误次数太多,请休息一会再来!\n");break;
			}
		}
		Sleep(2000);
		//调用dos命令清空控制台屏幕
		system("cls");
    }
}
//菜单函数
void menu()
{
	Sleep(2000);
	//调用dos命令清空控制台屏幕
	system("cls");
	//打印功能菜单界面
   	 Sleep(500);
    	printf("\n\n\t\t\t\t学员管理系统平台\n");
	
	Sleep(500);
	printf("\n\t\t************************************************\n");
	Sleep(500);
	printf("\n\t\t功能菜单:\n\n");
	Sleep(1000);
	
	printf("\t\t 1、录入单个学员信息      2、显示所有学员信息\n");
	
	Sleep(1000);
	
	printf("\t\t 3、排序显示学员信息     4、插入单个学员信息\n");
	
	Sleep(1000);
	
	printf("\t\t 5、删除单个学员信息     6、查找单个学员信息\n");
	
	Sleep(1000);
	
	printf("\t\t 7、读取所有学员信息     8、保存所有学员信息\n");
	
	Sleep(1000);
	
	printf("\t\t 9、清空全部学员信息     0、退出学员管理系统\n");
	
}
//录入函数
void input()
{
	int i;
	char answer;
	
	do
	{
		//录入学号
	    do
		{
		    printf("学号:");
			scanf("%d",&stu[n].NO);
		    // 判断输入格式是否有错
			while(stu[n].NO<=0 || stu[n].NO>50)
			{
				printf("\t:输入格式有误,请重新输入!\n");
			    fflush(stdin);  //判断输入其它字符(如:a,b,aa,skd...)时报错
				printf("学号:");
				scanf("%d",&stu[n].NO);
			}
			//循环遍历输入的学号是否重复
		    for(i=0;i<n;i++)
			{
			    if(stu[i].NO==stu[n].NO)
				{
				    printf("\t:学号重复,请重新输入!\n");
					break;
				}
			}
		}while(i<n);
        //录入姓名
		do
		{
		    printf("姓名:");
			scanf("%s",stu[n].name);
			//判断输入时姓名是否为空
            while(strlen(stu[n].name)==0)
			{
			    printf("\t:姓名不能为空,请重新输入!\n");
				printf("姓名:");
				scanf("%s",stu[n].name);
			}
            // 判断输入时姓名是否含有数字
			for(i=0;i<strlen(stu[n].name);i++)  
	        {
		        if(stu[n].name[i]>='0'&&stu[n].name[i]<='9')
		        {
		            printf("提示:姓名不能含有数字,请重新输入!\n");
			        break;
		        }
	        }
		}while(i<strlen(stu[n].name));
		//录入性别
		do
		{
			printf("性别");
			scanf("%s",stu[n].sex);
		}while(i<strlen(stu[n].sex));
			
		//录入专业
		do
		{
			printf("专业");
			scanf("%s",stu[n].subject);
		}while(i<strlen(stu[n].subject));
		
		//录入联系电话
		do
		{
			printf("电话号码");
			scanf("%s",&stu[n].phone);
		}while(i<strlen(stu[n].phone));
		
		//录入简历
		do
		{
			printf("简历\n");
			scanf("%s",stu[n].jianli);
		}while(i<strlen(stu[n].jianli);			
        	n++;//实际的人数自加一次
		//判断输入成绩的实际人数是否超出已定内存空间
		if(n<N)
		{
		    printf("是否继续录入?(y/n):");
		    fflush(stdin);//清空缓存
		    scanf("%c",&answer);
		}
		else
		{
		    printf("实际人数超出已定存储空间的内存,程序终止!\n");
			break;
		}
	}while(answer=='Y' || answer=='y');
}
//显示函数
void display()
{ 
	//打印表头
	printf("********************************************************************************\n");
	printf("学号\t姓名\t性别\t专业\n");
	printf("********************************************************************************\n");
	//循环打印学员信息
	for(int i=0;i<n;i++)
	{
		printf("%d\t%s\t%.2f\t%.2f\t%.2f\t%.2f\t%.2f\n",stu[i].NO,stu[i].name,stu[i].sex,stu[i].subject);
		printf("********************************************************************************\n");
    	}
	printf("\n联系电话\n");
	for(int i=0;i<n;i++)
	{
		printf("%d\n",stu[i].phone);
		printf("********************************************************************************\n");
	}
	printf("\n学历\n");
	for(int i=0;i<n;i++)
	{
		printf("%s",stu[i].jianli);
		printf("********************************************************************************\n");
	}
}
//排序函数
void sort()
{
	STU temp;//定义临时变量
	int i,j;
	//冒泡排序
	for(i=0;i<n-1;i++)
	{
		for(j=0;j<n-1-i;j++)
		{
			if(stu[j].avg<stu[j+1].avg)
			{
				temp=stu[j];
				stu[j]=stu[j+1];
				stu[j+1]=temp;
			}
		}
	}
}
//插入函数
void insert()
{
	int i,j;//定义循环变量
	STU newStu;//定义实行插入功能时输入的类型
	char answer;
	printf("单个学员信息的循环插入:\n");
	do
	{
		do
		{
			printf("学号:");
			scanf("%d",&newStu.NO);
			// 判断输入格式是否有错
			while(newStu.NO<=0 || newStu.NO>50)
			{
				printf("\t:输入格式有误,请重新输入!\n");
				fflush(stdin);  //判断输入其它字符(如:a,b,aa,skd...)时报错
				printf("学号:");
				scanf("%d",&newStu.NO);
			}
			//循环遍历输入的学号是否重复
			for(i=0;i<n;i++)
			{
				if(stu[i].NO==newStu.NO)
				{
					printf("\t:学号重复,请重新输入!\n");
					break;
				}
			}
		}while(i<n);
		do
		{
			printf("姓名:");
			scanf("%s",&newStu.name);
			//判断输入时姓名是否为空
			while(strlen(newStu.name)==0)
			{
				printf("\t:姓名不能为空,请重新输入!\n");
				printf("姓名:");
				scanf("%s",newStu.name);
			}
			// 判断输入时姓名是否含有数字
			for(i=0;i<strlen(newStu.name);i++)
			{
				if(newStu.name[i]>='0' && newStu.name[i]<='9')
				{
					printf("提示:姓名不能含有数字,请重新正确输入!\n");
					break;
				}
			}
		}while(i<strlen(newStu.name));
n++;//实际的人数自加一次
		sort();//调用排序函数
		//循环遍历找位置
		for(i=0;i<n;i++)
		{
			if(newStu.avg>stu[i].avg)
			{
				j=i;
				break;
			}
		}
		//移位
		for(i=n;i>j;i--)
		{
			stu[i]=stu[i-1];
		}
		stu[j]=newStu;//将newStu插入到j的位置
		
		//判断插入的实际人数是否超出已定内存空间
		if(n<N)
		{
			printf("是否继续插入?(y/n):");
			fflush(stdin);//清空缓存
			scanf("%c",&answer);
		}
		else
		{
			printf("实际人数超出已定存储空间的内存,程序终止!\n");
			break;
		}
	}while(answer=='Y' || answer=='y');
}
	//删除函数
	void remove()
	{
	int i,j,no;
	char answer;
	do
	{
		printf("请输入要删除学员的学号:");
		scanf("%d",&no);
		//循环遍历找位置
		for(i=0;i<n;i++)
		{
			if(no==stu[i].NO)
			{
				j=i;
				break;
			}
		}
		//移位
		if(i<n)
		{
			for(i=j;i<n-1;i++)
			{
				stu[i]=stu[i+1];
			}
			n--;//实际人数自减一个
			printf("\n\n系统在第%d个位置找到了学号为%d的学员!\n",j+1,no);
		}
		else
		{
			printf("没有找到您要删除的学员学号,请重新选择功能!\n");
		}
        //判断是否已经没有可以删除的人数
		if(n>0)
		{
			printf("是否继续删除?(y/n):");
			fflush(stdin);//清空缓存
			scanf("%c",&answer);
		}
		else
		{
			printf("已经没有可以删除的人数了,程序终止!\n");
			break;
	    }
	}while(answer=='Y' || answer=='y');
}
//查找函数
void search()
{
	int i,no;
	char answer;
	printf("请输入您要查找学员的学号:");
	scanf("%d",&no);
   
	do
	{
		 //循环遍历找位置
		for(i=0;i<n;i++)
		{
			if(stu[i].NO==no)
			{
				break;
			}
		}
		if(i<n)
		{
			printf("\n\n系统在第%d个位置找到了学号为%d的学员!\n",i+1,no);
			printf("该学员的信息如下:\n");
			printf("********************************************************************************\n");
			printf("学号\t姓名\t成绩一\t成绩二\t成绩三\t平均分\t总分\n");
			printf("********************************************************************************\n");
			printf("%d\t%s\t%.2f\t%.2f\t%.2f\t%.2f\t%.2f\n",stu[i].NO,stu[i].name,stu[i].score[0],stu[i].score[1],stu[i].score[2],stu[i].avg,stu[i].sum);
			printf("********************************************************************************\n");
		}
		else
		{
			printf("\n提示:对不起,没有找到学号为%d的学员\n",no);
		}
		//判断是否继续查询
		printf("是否继续查询?(y/n):");
		fflush(stdin);//清空缓存
		scanf("%c",&answer);
	}while(answer=='Y' || answer=='y');
}
//读取函数
int read()
{  
    FILE *fp;//定义文件指针变量
	fp=fopen("e:\\xueyuanguanlixitong.txt","rt");
	int n=fread(stu,sizeof(STU),N,fp);
	return n;
	
}
//保存函数
void save()
{   
	FILE *fp;//定义文件指针变量
	fp=fopen("e:\\xueyuanguanlixitong.txt","wb");
	fwrite(stu,sizeof(STU),n,fp);
	fclose(fp);
	printf("已保存在:e:\\xueyuanguanlixitong.txt\n");
	printf("\n\n\n\n\n\t\t\t\t保存成功!O(∩_∩)O~\n");
}
//主函数
void main()
{  
	login();//调用登录函数
	int choice,i;//定义用户选择变量
	do
	{
		//显示菜单
		menu();
		printf("\n\t请选择:");
		scanf("%d",&choice);    //接受用户选择
		switch(choice)
		{
			case 1:             
				  system("cls");  //清屏
				  printf("\n单个学员信息的循环录入\n");
				  input();
				  display();
				  system("pause");
				  break;
			case 2:            
				  system("cls");
				  display();
				  system("pause");  //暂停一下程序
				  break;
			case 3:            
				  system("cls");
				  if(n==0)
				  {
					printf("\t\t学员个数为0,无法排序,请先录入!\n");
					system("pause");
					break;
				  }
				  else
				  {
					sort(); ;//调用排序函数
					system("pause");
					break;
				  }
			case 4:
				  system("cls");
				  insert();     //调用插入函数
				  system("pause");
				  break;
			case 5:
				  system("cls");
				  remove();        //调用删除函数
				  system("pause");
				  break;
			case 6:
				  system("cls");
				  search();        //调用查找函数
				  system("pause");
				  break;
			case 7:
				  system("cls");
				  n=read();    //调用读取函数
				  printf("读取成功!\n");
				  system("pause");
				  break;
			case 8:
				  system("cls");
				  save();       //调用保存函数
				  system("pause");
				  break;
			case 9:
				  system("cls");   
				  n=0;            //清空学员个数
				  printf("清空完成!\n");
				  system("pause");
				  break;
			case 0:             //退出程序
				  system("cls");
				  for(i=5;i>=0;i--)
				  {
					Sleep(1000);
					system("cls");
					printf("\n\n\n\n\n\n\n\n\n\n\n\n\t\t请稍等,还有%d秒推出程序!\n\n\n",i);
				  }
				  system("cls");
				  printf("\n\n\n\n\n\n你已经成功退出程序\n\t\t谢谢使用,欢迎再次登录!\n");
				  exit(0);
				  break;
			default:
				  system("cls");
				  printf("\n\n\n\n\n\t\t请选择0-9之间的数!\n");
				  system("pause");
	    }
  }while(1);
}
㈣ 如何用c语言添加学生信息
构造一个关于学生信息的数据类型 
如:
struct studengt_type
{
int number;  //学号
char *name; //姓名
char sex; //性别
int score; // 入学成绩
}
㈤ c语言怎么编写学生信息
#include "stdio.h"
#include <stdlib.h>
#define SIZE 10
struct   student{
   char  id[20];
   char  sex[10];
   int   age;
   int   score[3];
   float average;
} stud[SIZE];
void input()  /* 输入学生的信息 */
{
  int i;
  
  for(i=0;i<SIZE;i++)
   { 
    printf("第%d个学生的信息:\n",i+1);
      scanf("%s%s%d%d%d%d",stud[i].id,stud[i].sex,&stud[i].age,&stud[i].score[0],&stud[i].score[1],&stud[i].score[2]);
    stud[i].average=(stud[i].score[0]+stud[i].score[1]+stud[i].score[2])/3.0;
    }    
}
void output()  /* 输出学生的信息 */
{
  int i;
  
  printf("\n");
  for(i=0;i<SIZE;i++)
    printf("%s %s %d %d %d %d %3.1f\n",stud[i].id,stud[i].sex,stud[i].age,stud[i].score[0],stud[i].score[1],stud[i].score[2],stud[i].average);
}
void sortput()  /* 排序输出学生信息 */
{
 int i,j;
 struct student temp;
 
 for(i=0;i<SIZE;i++)
 {
    for(j=0;j<SIZE-i-1;j++)
    {
         if(stud[j].average<stud[j+1].average)
         {
            temp=stud[j];
            stud[j]=stud[j+1];
            stud[j+1]=temp;
          }
    }
 }
   printf("\n");
   for(i=0;i<SIZE;i++)
      printf("%s %s %d %d %d %d %3.1f\n",stud[i].id,stud[i].sex,stud[i].age,stud[i].score[0],stud[i].score[1],stud[i].score[2],stud[i].average);
}
void main()
{
   input();
   output();
   sortput();
}
㈥ c语言用链表添加学生信息
#include<stdio.h>
#include<string.h>
#include"stdlib.h"
#defineLENsizeof(structstu)
structstu
{
longnum;
charname[20];
charsex;
intage;
charaddr[30];
structstu*next;
};
intmain()
{
intn;
structstu*head;
structstu*p1,*p2;
head=(structstu*)malloc(LEN);
head->next=NULL;
p1=head;
p2=(structstu*)malloc(LEN);
p2->next=NULL;
printf("学号 姓名 性别 年龄 住址 ");
scanf("%ld, %s, %c, %d, %s",&p2->num,&p2->name,&p2->sex,&p2->age,&p2->addr);
while(p2->num!=0)
{
p1->next=p2;
p1=p2;
fflush(stdin);
p2=(structstu*)malloc(LEN);
printf("学号 姓名 性别 年龄 住址 ");
scanf("%ld,%s,%c,%d,%s",&p2->num,&p2->name,&p2->sex,&p2->age,&p2->addr);
}
}
纯手打,希望采纳。
㈦ c语言学生管理系统中的增加学生信息
#include<iostream.h> 
#include<iomanip.h>
#include<windows.h>
#include <conio.h> 
void back();//返回开始菜单
void out();//输出信息
int w=1; //用于记录学生人数,全局变量
class Data//日期类
{public:
    double Year,Month,Day;
    Data()
    {  Year=0;Month=0;Day=0;   }
};
class student //学生类
{
public: 
char name[10]; //姓名
char sex[5]; //性别
char jiguan[10]; //籍贯
int num,age;//学号,年龄
char adr[30];//住址
Data year;
friend class Data;//date作为student的友元                                 //定义一个日期类
void operator=(student s); //=重载
int operator == (student s);//==重载
}stu[100]; 
void main() 
{
system("cls");//清屏 DOC调用
system("color f4"); //颜色 同样是调用doc
int i;
void comp(); 
void input(); 
void find();
void alt() ;
void del(); 
void exit();
void show();
cout<<setw(53)<<"欢迎进入学生管理系统!"<<endl; 
cout<<setw(55)<<"1 添加学生信息 2 查询学生信息"<<endl<<endl; 
cout<<setw(55)<<"3 删除学生信息 4 修改学生信息"<<endl<<endl; 
cout<<setw(55)<<"5 比较学生信息 6 显示学生信息"<<endl<<endl;
cout<<setw(45)<<"0 推出系统"<<endl;
cout<<"请选择:"; 
cin>>i;
if(i>6||i<0) 
{
    cout<<"输入有误!"<<endl;
    back();
} 
switch(i)
{ 
case 1:input();break; 
case 2:find();break; 
case 3:del();break; 
case 4:alt();break;
case 5:comp();break;
case 6:show();break;
case 0:exit();break;
default:cout<<"你的输入有误!\n"; 
}
} 
void input() //添加学生
{
system("color 84"); //颜色 同样是调用doc
system("cls");//清屏
int n; 
cout<<"请输入要添加的学生个数:\n"; 
cin>>n;
if(n>=100||n<=0) 
{cout<<"输入有误!<<endl";
main(); }
else
{ 
for(;n>0;w++,n--) 
    {
     cout<<"请输入姓名、性别、籍贯,年龄,学号,住址:"<<endl; 
     cin>>stu[w].name>>stu[w].sex>>stu[w].jiguan>>stu[w].age >>stu[w].num>>stu[w].adr ; 
     cout<<"请输入该生生日(年 月 日)"<<endl;
     cin>>stu[w].year.Year;
     cin>>stu[w].year.Month;
     cin>>stu[w].year.Day;
    } 
   out();
}
  cout<<"添加完毕2秒后返回"<<endl;
  Sleep(2000); //延时2秒 
  main();
} 
void find() //按学号查找学生
{
system("color f4"); //颜色 同样是调用doc
system("cls");
int i,id,j=0;//j是用以记录是否有信息被找到 
cout<<"请输入你要查找学生的学号:"; 
cin>>id;
for(i=1;i<w;i++)
if(stu[i].num ==id) 
{
    cout<<i<<"   "<<stu[i].name<<" "<<stu[i].sex<<" "<<stu[i].jiguan<<" "<<stu[i].age<<" "<<stu[i].num<<" "<<stu[i].year.Year<<" "<<stu[i].year.Month<<" "<<stu[i].year.Day<<stu[i].adr<<endl;
    j++;
}
if(j==0)
cout<<"没有你要查找的信息";
back();
} 
void del()//删除指定学号学生信息 
{
system("color f4"); //颜色 同样是调用doc
int i,a,y=0;
char x;
cout<<"请输入要删除的学生学号"; 
cin>>a;
for(i=1;i<w;i++)
  if(stu[i].num==a)
  {
     cout<<"该生情况:"<<endl;
    cout<<i<<"   "<<stu[i].name<<"   "<<stu[i].sex<<"    "<<stu[i].jiguan<<"   "<<stu[i].age<<"   "<<stu[i].num<<"  "<<stu[i].year.Year<<" "<<stu[i].year.Month<<" "<<stu[i].year.Day<<"   "<<stu[i].adr<<endl;
    cout<<"是否确认删除?(Y/N)"<<endl;
    cin>>x;
    if(x=='Y'||x=='y')
    {
    y++;
    for(;i<w-1;i++) 
    stu[i]=stu[i+1];
    w--;//每删除一个对总是减少一个
    }
  }
㈧ C语言学生管理系统如何添加多项学生信息
可以用while循环实现的:
while(1){
    //输入学生的姓名
    if(strcmp(stu.name,"0") == 0)    //如果姓名为“0”则退出循环体
            break;        
    //输入学生的其他属性信息
        ....
    //换行
}
希望对你有帮助吧。
㈨ 学生信息录入模块C语言
/*主程序功能模块—-文件名:student.c*/ 
#define MAX_BAR 4 /*最大菜单数,可以自定*/ 
#include"io.h" 
#include"dos.h" 
#include"fcntl.h" 
#include"stdio.h" 
#include"stdlib.h" 
#include"math.h" 
#include"graphics.h" 
#include"chi_asc.c" /*调用图形模式下汉字、字符共显功能*/ 
#include"public.c" /*按键定义功能*/ 
#include"mypcx.c" /*封面图象调用滚谈功能,此处为pcx图象*/ 
#include"stu_frame.c" /*框架绘制功能*/ 
#include"stu_sub.c"巧春 /*各子菜单功能*/ 
main() 
{ 
/*old_bar、curr_bar表示上次选中的菜单、当前选中的菜单*/ 
/*old_sonbar curr_sonbar表示上次选中的子菜单、当前选中的子菜孝备耐单*/ 
int i,key,key_son,old_bar,curr_bar,curr_sonbar,old_sonbar,size; 
int save_startx,save_starty,save_endx,save_endy,sonbar_out=0; 
void *buf; 
int Driver,Mode; 
char *pcx; 
struct student_bar{ 
int start_x,start_y; /*起始横坐标,起始纵坐标*/ 
int length_x,length_y; /*菜单的长,菜单的宽*/ 
int num_son; /*包含子菜单的个数*/ 
char *p_father; /*菜单项名,*p_son[5]为子菜单名*/ 
char *p_son[5];}stu_bar[MAX_BAR]={ 
{10,45,120,25,4,"File Operation",{" Open file"," New file"," Save file","Exit system"}}, 
{130,45,120,25,3,"Data Edition",{" Add object","Delete object","Modify object"}}, 
{250,45,120,25,0,"File Print",{""}}, 
{370,45,120,25,0,"Help Message",{""}} 
};/*定义各功能菜单的结构体*/ 
pcx="stusys4.pcx"; 
Set_Video_Mode(VGA256); /*转换屏幕到320*200*256色*/ 
PCX_Load_Screen(pcx,1); /*读取封面图象stusys4.pcx*/ 
Driver=DETECT,Mode=0; 
initgraph(&Driver,&Mode,""); /*设置图象模式*/ 
cleardevice(); 
main_frame(BLUE,LIGHTGRAY); /*绘制主框架图,底色为蓝色*/ 
/*绘制菜单*/ 
for(i=0;i<MAX_BAR;i++) 
{ 
setcolor(BLUE); 
rectangle(stu_bar[i].start_x, stu_bar[i].start_y, stu_bar[i].start_x+stu_bar[i].length_x, stu_bar[i].start_y+stu_bar[i].length_y); 
puthz16(stu_bar[i].start_x+8,stu_bar[i].start_y+5,-8,BLUE,stu_bar[i].p_father); 
}puthz16(stu_bar[0].start_x+8,stu_bar[0].start_y+5,-8,WHITE,stu_bar[0].p_father); 
old_bar=0;curr_bar=0; 
/*读取按键字符,如为ESC则退出*/ 
while((key=specialkey())!=ESC){ 
old_bar=curr_bar; 
if(sonbar_out==1)sonbar_out=0; 
if(key==LEFT){ 
if(curr_bar==0)curr_bar=3; 
else curr_bar=curr_bar-1; 
}/*LEFT finished*/ 
if(key==RIGHT){ 
if(curr_bar==3)curr_bar=0; 
else curr_bar=curr_bar+1; 
}/*RIGHT finished*/ 
/*如按键为ENTER,则绘制子菜单*/ 
if(key==ENTER){ 
save_startx=stu_bar[curr_bar].start_x; 
save_starty=stu_bar[curr_bar].start_y+stu_bar[curr_bar].length_y+1; 
save_endx=stu_bar[curr_bar].start_x+stu_bar[curr_bar].length_x; 
/*保存子菜单展开后掩盖住的图象*/ save_endy=stu_bar[curr_bar].start_y+stu_bar[curr_bar].length_y+stu_bar[curr_bar].num_son*stu_bar[curr_bar].length_y+1; 
size=imagesize(save_startx,save_starty,save_endx,save_endy); 
if(size!=-1) 
{ 
buf=malloc(size); 
if(buf)getimage(save_startx,save_starty,save_endx,save_endy,buf); 
else {printf("OUT MEMORY");exit(0);} 
} 
setviewport(save_startx,save_starty,save_endx,save_endy,1); 
setcolor(WHITE); 
clearviewport(); 
for(i=1;i<=stu_bar[curr_bar].num_son;i++) 
{ 
rectangle(0,0,stu_bar[curr_bar].length_x,i*stu_bar[curr_bar].length_y); 
setfillstyle(SOLID_FILL,LIGHTGRAY); 
floodfill(stu_bar[curr_bar].length_x-1,i*stu_bar[curr_bar].length_y-1,WHITE); 
} 
for(i=0;i<stu_bar[curr_bar].num_son;i++) 
puthz16(8,i*stu_bar[curr_bar].length_y+5,-8,BLUE,stu_bar[curr_bar].p_son[i]); 
puthz16(8,5,-8,WHITE,stu_bar[curr_bar].p_son[0]); 
old_sonbar=0;curr_sonbar=0; 
if(stu_bar[curr_bar].num_son) 
while(((key_son=specialkey())!=ESC)&&sonbar_out==0){ 
old_sonbar=curr_sonbar; 
if(key_son==UP){ 
if(curr_sonbar==0) curr_sonbar=stu_bar[curr_bar].num_son-1; 
else curr_sonbar=curr_sonbar-1; 
} 
if(key_son==DOWN){ 
if(curr_sonbar==(stu_bar[curr_bar].num_son-1)) curr_sonbar=0; 
else curr_sonbar=curr_sonbar+1; 
} 
puthz16(8,old_sonbar*stu_bar[curr_bar].length_y+5,-8,BLUE,stu_bar[curr_bar].p_son[old_sonbar]); 
puthz16(8,curr_sonbar*stu_bar[curr_bar].length_y+5,-8,WHITE,stu_bar[curr_bar].p_son[curr_sonbar]); 
if(key_son==ENTER){ 
setviewport(0,0,639,479,1); 
putimage(save_startx,save_starty,buf,COPY_PUT); 
free(buf); 
sonbar_out=1; 
if(curr_bar==0) 
switch(curr_sonbar){ 
case 0: 
fil_open(); /*调用stu_sub.c文件中fil_open()函数,打开文件*/ 
break; 
case 1: 
fil_new(); /*调用stu_sub.c文件中fil_new()函数,新建文件*/ 
break; 
case 2: 
fil_save(); /*调用stu_sub.c文件中fil_save()函数,保存文件*/ 
break; 
case 3: 
sys_exit(); /*调用stu_sub.c文件中sys_exit()函数,退出系统*/ 
} 
if(curr_bar==1) 
switch(curr_sonbar){ 
case 0: 
dat_add(); /*调用stu_sub.c文件中dat_add()函数,添加记录*/ 
break; 
case 1: 
dat_dele(); /*调用stu_sub.c文件中dat_dele()函数,删除记录*/ 
break; 
case 2: 
dat_mod(); /*调用stu_sub.c文件中dat_mod()函数,修改记录*/ 
break; 
} 
} /*key_son=ENTER finished*/ 
}/*key_son all finished*/ 
if(sonbar_out==0){ 
setviewport(0,0,639,479,1); 
putimage(save_startx,save_starty,buf,COPY_PUT); 
free(buf); /*还原子菜单掩盖住的图象,并释放子菜单所占用的内存*/ 
} 
/*如果子菜单项为0*/ 
if(!stu_bar[curr_bar].num_son){ 
if(curr_bar==2) 
fil_prn(); /*调用stu_sub.c文件中fil_prn()函数,打印文件*/ 
if(curr_bar==3) 
hel_mess(); /*调用stu_sub.c文件中hel_mess()函数,显示帮助信息*/ 
} 
} /*ENTER finished*/ 
puthz16(stu_bar[old_bar].start_x+8,stu_bar[old_bar].start_y+5,-8,BLUE,stu_bar[old_bar].p_father); 
puthz16(stu_bar[curr_bar].start_x+8,stu_bar[curr_bar].start_y+5,-8,WHITE,stu_bar[curr_bar].p_father); 
}/*key all finished*/ 
fcloseall(); /*关闭所有文件*/ 
closegraph(); /*关闭图形状态*/ 
} 
自己改改!!!
希望能解决您的问题。
㈩ C语言输入学生信息
scanf里面的空格与/去掉
