⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 复件 wu项.c

📁 这是以项目开发为列的学生管理系统
💻 C
📖 第 1 页 / 共 3 页
字号:
									
									}		
									else 
										 {  
											 if(j==0 && atoi(s)>100)//分数范围是否在0到100
													{
                                                        wenttoxy(5,18);printf("                                                            ");

														 wenttoxy(5,18);printf("Numerical value does not between 100 and in 0");
													}
										     else

											 {
                                                  
                                               		*score=atof(s);					   
												   if(atof(s)<=100.0 && (k!=1))  //分数输入正确时将其输出
												 
														{
												           	   
													     wenttoxy(39,5+l);printf("            ");
													     wenttoxy(39,5+l);
														 printf("%.1f",atof(s));
														  wenttoxy(5,18) ; printf("                                                                 ");
                                                            break;



														}
                                               
											 }
										 }	 
                          

							}   
        



				}

		}


	}
 }
while(1);

}
/***********************************************************************************************
添加学生信息
  
***********************************************************************************************/
void add()
{char c;char s[7];
 char sno[4];char a[7];
 int i;
	do 
	{       i=counts;        
		system("cls");
					addcaidan();   //调用添加菜单
		if(counts>100)
		{
				  printf("record over 100!");getch();
				  Main_Menu();break;
		}
				 MakeSno( stu[ i].sno, counts);
				 NameVerification(stu[i].name);
				 AgeVerification(&stu[i].age,a);
				 ScoreVerifies(&stu[i].score[0], s,1);
				 ScoreVerifies(&stu[i].score[1], s,2);
				 ScoreVerifies(&stu[i].score[2], s,3);
	             ScoreVerifies(&stu[i].score[3], s,4);
				 ScoreVerifies(&stu[i].score[4], s,5);
    			 wenttoxy(5,18);
				 printf("Add a record success, whether or not to continue the time of admission?[y\Y],[n\N]\n") ;
				 counts++;
         while(1)
		 {	
			 c=getche();
			   if(c=='n'||c=='N')  	
				{
					 
					 Main_Menu();
         				 
				}
               else if(c=='y'||c=='Y')
			  		   break;
               else
			   {
				   wenttoxy(5,21);
				   printf("your puts is wrong!");
			   }
		 }
	}
	 while(1);
     
}
/***********************************************************************************************
 退出系统的函数
 退出保存和退出不保存


***********************************************************************************************/
void out()
{
  char c;
 if(fsave!=1)/*********记录是否有没保存的********************/
 {
  printf("do you want to save info[y]");
  c=getche();
  if(c=='y'||c=='Y')/************保存后退出***************************************/
    { 
     save(counts,1);
     exit(0);
    }
    else 
     {
       if(c=='n'||c=='N')/*********************************退出************************/
       exit(0);
        else
      Main_Menu();
     }
        
  }
   else
  { 
   
   do
   {
     c=getche();
	 printf("will you want exit?(y/Y,n/N)");  
     if(c=='y'||c=='Y'||c=='n'||c=='N')     
     break;
      else 
    {
      wenttoxy(5,18);printf("your puts is wrong!");
    }
   } 
   while(1);
    if(c=='y'||c=='Y')
      exit(0);
    else
     Main_Menu();

  }

}
/*********************************************************************************************
添加菜单界面
                                            

*********************************************************************************************/ 
void  addcaidan()
{		system("cls");
		wenttoxy(28,0);printf("****************************\n");
		wenttoxy(28,1);printf("*       Add Stu Info       *\n");
		wenttoxy(28,2);printf("****************************\n");
		wenttoxy(28,3);printf("Sno:");
		wenttoxy(28,4);printf("Name:");
		wenttoxy(28,5);printf("Age:");
        wenttoxy(28,6);printf("Chinese:");
        wenttoxy(28,7);printf("Enlish:");
        wenttoxy(28,8);printf("Chemistry:");
		wenttoxy(28,9);printf("Physical:");
		wenttoxy(28,10);printf("Math:");
} 
/************************************************************************************************

                                        排序菜单

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

  void  Sort_Stu_Info()
  {	    
	    char c;
	    system("cls");
		wenttoxy(28,0);printf("****************************\n");
		wenttoxy(28,1);printf("*       Sort  Stu Info     *\n");
		wenttoxy(28,2);printf("****************************\n");
		wenttoxy(28,3);printf("1-------Order By Sno  Desc\n");
		wenttoxy(28,4);printf("2-------Order By Sno  Asc\n");
		wenttoxy(28,5);printf("3-------Order By Score  Desc\n");
		wenttoxy(28,6);printf("4-------Order By Score  Asc\n");
		wenttoxy(28,7);printf("0-------back to Main  Menu\n");
		wenttoxy(5,18);printf("Please enter your choose[0-4]:") ;
    if(counts==0)
		{
		   printf("it is not having records");
		   getch();
		   Main_Menu();
		}
     while(1) 
		{
	        wenttoxy(37,18);
		    c=getche();
			if(!(c>='0' && c<='4'))
				{
				  printf("That you import is illegal character,please try again");
				}
			else 
				break;
		}
	    switch(c)
			{
		case '1':OrderBySno(1);//PrintInfo( stu, counts, page,1,1);
			  break;
		case '2':OrderBySno(-1);break;
        case '3':
			OrderByTotscore(1);
			//PrintInfo( stu, counts, page,0,-1);
			break;
        case '4':OrderByTotscore(-1);//PrintInfo( stu, counts, page,0,-1);
			  break;
     	case '0':Main_Menu();break;	
	
			}
}
/************************************************************************************************

                            打印界面菜单                                                    


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

  void  print()
	     {   
			system("cls");
			wenttoxy(28,0);printf("****************************\n");
			wenttoxy(28,1);printf("*          print           *\n");
			wenttoxy(28,2);printf("****************************\n");
	
		 }
/***********************************************************************************************


                              退出菜单                                                        

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

  void  Exit_System()
{ 
		system("cls"); 
		wenttoxy(28,0);printf("****************************\n");
		wenttoxy(28,1);printf("*       Exit System        *\n");
		wenttoxy(28,2);printf("****************************\n");
		wenttoxy(28,3);printf("0.Exit System \n");
		wenttoxy(28,4);printf("1.back to Main  Menu \n");
  }
 /**********************************************************************************************
								 
去除学号输入的左右空格                                            

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

void  Sno_kongge(char s[])//去除分数的左右空格

{  
   int m,i,j,k;k=0;
          wenttoxy(39,10);
		  printf("             ");
		  wenttoxy(39,10);
		  gotstring(s,7);
           j=strlen(s);
           m=j-1;  
do
	{       
			if(s[m]==' ') 
			{	s[m]='\0';}
			m--;
	}
	while(s[m]==' ');
 
            i=0;
do       
   {      
	        if(s[i]==' ') 
			{k++;}
			i++;
   }
    while(s[i]==' ');
   strcpy(s,&s[k]);
   wenttoxy(39,10);
   printf("%s",s);
  

}
/**********************************************************************************************
按学号查找
k等于1表示升序排列
k等于-1表示降序排列
   
**********************************************************************************************/
void SearchBySno()
{				char s[4];int i,j,k;
                   char c;
                    struct student str[27] ;
					k=0;
do		           
               
	{		
	   do
			       
			{				j=0;
				        Sno_kongge(s);
				     if(strlen(s)!=3)	   
			        				{	
						  					    wenttoxy(5,18);
												printf("the lenth of sno must three ,please retry again ");
									}	  
				
				else 
				{   
					 for(i=0;i<=2;i++)
						{
							if(!('0'<=s[i] && s[i]<='9'))
								{					 
									j=1;		
								}     
						
						}

				       if(j==1) 
					   { 
									   wenttoxy(5,18);
									   printf("That you import is illegal character,please try again");
					   }
						 else	
							 break;
					
				}
			}

		while(1);
       for(i=0;i<counts;i++)
		{
               if(strcmp(stu[i].sno,s)==0)
			    {	
					   str[k]=stu[i];
					         k++;
					   printf("Seek success");
					   break;
				}                                               
        
			    else 

				{
					wenttoxy(5,20);
					printf("the record can't find!");

				}
	   
	   }
	     wenttoxy(5,20);
		 printf("                                                ");
		 wenttoxy(5,20);
		printf("Will you want to continue to increase inquiry?(Y\y,N\n)");
       
		   do
			 {
			  c =getche();
			   if(c!='y' && c!='Y' && c!='n' && c!='N' )
					{		
						      wenttoxy(5,18);printf("                                ");
							 printf("That you import is illegal character!");

					}
			   else 
				   if(c=='n'|| c=='N')
					Search_Stu_Info();
			   else 
					{if(c=='y'|| c=='Y')
						break;
					}
			 }
		  while(1);
     system("cls");
	 wenttoxy(10,5);printf("Search By Sno");
	if(k!=0)
      	PrintInfo( str, k, 1,2,1) ;
						 else
							{
								 printf("system don't find record!");
								 getch();Main_Menu();
							}			  


}
	while(1); 
		


}
 /***********************************************************************************************
  按姓名查找 
  (模糊查找)
                                                                                

 **********************************************************************************************/
 void SearchByName()
{     struct student temp[100];
   char name[24];int k,i;k=0;
   SearchNameVerification(name);
   for(i=0;i<=counts;i++)
     {
       if(strstr(strupr(stu[i].name),strupr(name))!=0)
	   {
		      temp[k++]=stu[i];
		      break;
		   
	   }	   
     
     }
   if(k!=0)
   PrintInfo(temp, k, 1,1,1);
   else 
 { 
    printf("the record don't find,please any key to try again!");
	getch();
    Search_Stu_Info();
 }


}
 /*********************************************************************************************
查询学生信息的菜单界面 
                                                                       

***********************************************************************************************/
  void  Search_Stu_Info()
  {     char c;  
		system("cls");
		wenttoxy(28,0);printf("****************************\n");
		wenttoxy(28,1);printf("*       Search  Stu Info   *\n");
		wenttoxy(28,2);printf("****************************\n");
		
        if(counts==0)
				{  
					printf("it is not having records");
					Main_Menu();
				}
         
        wenttoxy(28,3);printf("1-------Search By Sno \n");
		wenttoxy(28,4);printf("2-------Search By Name\n");
		wenttoxy(28,5);printf("0.back to Main  Menu\n");
		wenttoxy(5,18);printf("Please enter your choose[0-2]:\n") ;
		 while(1)
			{
			    wenttoxy(36,18);c=getche();
				if(!(c>='0' && c<='2'))
						{	
								printf("your puts is wrong");
						}
				else
					break;
			}
		 switch(c)
			{
				 case '1': wenttoxy(28,10);printf("the sno:");SearchBySno();break;
                 case '2':wenttoxy(28,10);printf("the name:");SearchByName(); break;
                 case '0':Main_Menu();  break;

			}
 
  }


/**********************************************************************************************
打印当前页面
参数:page表示传入的页面
     flag
	 t                                                                            
***********************************************************************************************/

int Printthis(int page,int counts,int flag,int t)
 { 
					char select;
					int totpage;
					totpage=counts%10==0?counts/10:counts/10+1;
   
  if(counts==0)
			{
					wenttoxy(5,18);
					printf("it is not having record");getch();
					
					 Main_Menu();
			} 
 			
do
	{         
		   wenttoxy(0,3);
			printf("................................................................................\n");
		    wenttoxy(0,4);
			printf("%-4s%-21s%-4s%-8s%-8s%-6s%-8s%-10s%-6s%5s","sno","name","age","chinese","english","math","physics","chemistry","total","avg");	
	    	wenttoxy(0,5);
			printf("................................................................................\n");
	        wenttoxy(5,18);		
		    printf("[%d/%d] [1]last page [2]next page [3]first page [4] end page [5]what page [6]delete [0]back\n",page,totpage);
          	wenttoxy(10,20); 
						printf("please select [0-5]:");
						select=getche();
        if((t==1 && !(select>='0' && select<='6')) || (t==0 && !(select>='0' && select<='5')))
		
				{	 if(select=='\r')                
								{   
				                   wenttoxy(5,21);printf("%*s",80," ");
	                               wenttoxy(5,21);
					               printf("The content that you import is that empty space content imports [0-5] please again,");
								}
					else
							{
				               wenttoxy(5,21);printf("%*s",100," ");
							   wenttoxy(5,21);printf("The number that you import has exceeded range, import again please[0-5]");
							} 
				} 
		
	      else 
			  
		  {	  if(select=='0')   Main_Menu();
		               
		        else 
					
		break;
		  
		  }	    
	}
 while(1);
	return select;
}
/************************************************************************************************
打印学生信息 
并能实现翻页功能

**********************************************************************************************/
void PrintInfo(struct student s[],int counts,int page,int flag,int t) 
{    
	char select;char a;
	float avg;double tot;int i;int totpage;int j;
	j=0;
    avg=0;
	
while(1)	
	{
	    
		totpage=counts%10==0?counts/10:counts/10+1;
		for(i=(page-1)*10;i<page*10;i++)
		{               tot=0;	
			     for(j=0;j<=4;j++)
				 {           
						tot+=s[i].score[j];
						
				 }
			            avg=(float)tot/5;
						wenttoxy(0,8+i-(page-1)*10);

		if(i>=counts)
			{ 
						printf("%*s",800," ");
						break;
			}
				else  if(flag==0)
						{
							printf("%-4s%-20s%4d%8.1f%6.1f%8.1f%10.1f%8.1f%6.1f%6.1f",s[i].sno,s[i].name,s[i].age,
						    s[i].score[0],s[i].score[1],s[i].score[2],s[i].score[3],s[i].score[4],tot,avg);
						}
						else if(flag==1)
						{
							printf("%-4s%-20s%4d%8.1f%6.1f%8.1f%10.1f%8.1f%6.1f%6.1f", s[i].sno,s[i].name,s[i].age,
						   s[i].score[0],s[i].score[1],s[i].score[2],s[i].score[3],s[i].score[4]);                              
						}
						else if(flag==2)
						{
							printf("%-4s%-20s%4d%8.1f%6.1f%8.1f%10.1f%8.1f%6.1f%6.1f", s[i].sno,s[i].name,s[i].age,
						     s[i].score[0],s[i].score[1],s[i].score[2],s[i].score[3],s[i].score[4]);   
						} 
		}				 
		
		select=Printthis( page, counts, 0,t);
		switch(select)
			{
			
				case '1':if(page>1)
							page--;break;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -