Home > Back-end >  Small white for help, you help me to look at the code to what is going wrong
Small white for help, you help me to look at the code to what is going wrong

Time:11-01

Started learning data structure, do you want to be a student information management system of the project, to add student information finished this part of the operation and then stop running show, where there is something wrong with ah I





#include
#include
#include
#include
# define comparename "2016550707"
# define compareword "666666"

Typedef enum menu
{the Exit, the Add, Show, Delete, sort, Change, Search, Lesson #,
} the MENU;

Struct Lb//define the structure as a chain of nodes, storage of student information
{char cName [50];
Char cNumber [50].
Int iMath;
Int iEnglish;
Int iProgram;
Int iScore;
Struct Lb * pNext;

};


Void ini ();
Int islogin ();
Int Manuselect ();
Void the mainmenu ();
Void Add_Information ();
Void the Quit ();

Lb * pNew=NULL;
Lb * pHead=NULL;
Char username [11].
Char password [6].
Int K, iCount;

Int main ()
{
Ini ();
The mainmenu ();
return 0;
}

/*
The system is initialized
*/

Void ini ()
{
System (color "f5");
Printf (" welcome to the student management system \ n ");
Printf (" please input your account: ");
Gets (username); printf("\n");
Printf (" please input your password: ");
Gets (password);
Islogin ();
}


/*
Determine whether login
*/
Int islogin ()

{int I;
Char cuowu []={" input errors to input "};
while(! (STRCMP (username, comparename)==0 & amp; & STRCMP (password, compareword)==0))
{
for(i=0; i<9. I++)
{
Printf (" % c ", cuowu [I]);
Sleep (300);
}
Getch ();
System (" Cls ");
Ini ();
}
return 1;
}

/*
Directory to choose
*/

Int Manuselect ()
{char c;
System (" CLS ");
Sleep (300);
Printf (" \ n \ n \ n ");
Printf (" \ \ t \ \ t t t1 add information 2 grades show \ n ");
Printf (" \ \ t \ \ t t t3 delete information 4 scores ranking \ n ");
Printf (" \ t t \ \ t \ t5 scores query information exchange 6 \ n ");
Printf (" \ t t \ \ t \ n \ 0 exit t7 has curriculum system ");
Printf (" do you want to do (0 to 7) : ");
C=getche ();
If (c> '7' | | c<'0')
{
Manuselect ();
}

Return the c - '0';
}

/*
The main menu
*/

Void the mainmenu ()
{
If (islogin ()==1)
{system (" CLS ");

The switch (Manuselect ())
{
Case (Add) :
System (" CLS ");
Add_Information ();
Sleep (300);
The Quit ();
break;
Default:
System (" CLS ");
Printf (" the name 'LLL ");
The Quit ();
break;
}
}

}

/*
Add information
*/
Void Add_Information ()
{

System (" CLS ");
PNew=(Lb) * malloc (sizeof (Lb));
Printf (" \ \ t \ \ t \ \ t t t t add student information: \ n \ n \ n \ n \ \ t \ \ t \ \ t t t t student number: ");
The scanf (" % s ", pNew - & gt; CNumber);
Printf (" \ n \ \ t \ \ t \ \ t t t t name: ");
The scanf (" % s ", pNew - & gt; CName);
Printf (" \ n \ \ t \ \ t \ \ t t t t: higher mathematics ");
The scanf (" % d ", & amp; PNew - & gt; IMath);
Printf (" \ n \ \ t \ \ t \ \ t t t t college English: ");
The scanf (" % d ", & amp; PNew - & gt; IEnglish);
Printf (" \ n \ \ t \ \ t \ \ t t t t program design: ");
The scanf (" % d ", & amp; PNew - & gt; IProgram);
PNew - & gt; IScore=pNew - & gt; IEnglish + pNew - & gt; IMath + pNew - & gt; IProgram;
PNew - & gt; PNext=pHead - & gt; PNext;
PHead - & gt; PNext=pNew;
PNew=NULL;
ICount++;
}
/*
Exit options
*/
Void the Quit ()
{char ch;
Ch=getch ();
If (ch==0 x1b)//esc key press
{
_exit (0);
}
The mainmenu ();

}
  • Related