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

📄 zong wu项.c

📁 这是以项目开发为列的学生管理系统
💻 C
📖 第 1 页 / 共 4 页
字号:
		  printf("                                         ");
    			   break;
                          
		}
   }
   }  
   
   while(1);
}
/***********************************************************************************************
 去除分数的左右空格                                       
 参数:s[]为字符型分数变量
       l为众坐标的改变值,用于光标定位
***********************************************************************************************/
void  Score_kongge(char s[],int l)//去除分数的左右空格
{  
   int m,i,j,k;k=0;
          wenttoxy(39,5+l);
		  printf("             ");
		  wenttoxy(39,5+l);
		  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,5+l);
   printf("%s",s);
  

}
/***********************************************************************************************
分数的验证函数
参数:*score为学生分数的指针变量
      s[]为分数的字符型变量,用于输入便于验证
	  l为纵坐标的变化量用于光标定位    
                   
************************************************************************************************/
void ScoreVerifies(double *score,char s[],int l)//分数的验证
{		int i,j,k,n;i=0;
     
   do      
   {       
	        Score_kongge(s,l);
			n=strlen(s);
			k=0;j=0;
if(n>4) //分数字符串的长度判断
				{				wenttoxy(5,18);
	                            printf("                                                  ");
								wenttoxy(5,18);
								printf("The length of score more than four results");getch();
								
				}
else  
	{	
		if(n<=4)
			for(i=0;s[i]!='\0';i++)
		{ 
				if(s[i]=='.') j++;	//求小数点的个数
			else
			{
				if(!(s[i]>='0' && s[i]<='9')&& s[i]!='.')  k=1;//判断是否为非法字符
			     
			}
		}	
			
			if(k==1)    {
				           wenttoxy(5,18);printf("                                                  "); 
			               wenttoxy(5,18);printf("Score is illegal alphabetic string");
						}//小数点是否为1个
             
		{
					if(j>=2) //小数点大于1个
					{  
						    wenttoxy(5,18);printf("                                                                ");
					        wenttoxy(5,18);	printf("The number of decimal places for more than one, the error"); 
					}                
					else //小数点为一个时,小数点的位置在首位和末位是错误的
				{ 
								if(j==1 && (s[0]=='.'||s[n-1]=='.') )

								{    wenttoxy(5,18);printf("                                                            ");
								      wenttoxy(5,18);printf("The radix point location has been wrong\n");
								}				
					else  
						{	
					         
								if(j==1 && s[n-2]=='.'&& (s[n-1]!='0' && s[n-1]!='5'))//小数点正确但是小数部分不对
									{
									      wenttoxy(5,18);printf("                                                            ");	
									       wenttoxy(5,18);printf("The decimal part is not 0 or 5");
									
									}		
									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 

				{

⌨️ 快捷键说明

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