Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //The username and the pass for the admin are admin 12321
- #include <stdio.h>
- void payment(int SInfo[100][6])
- {
- //it's gonna print the payment info for a student chosen by the administrator
- }
- void add(int SInfo[100][6], int TInfo[100][7], int CInfo[3][3], int TAssessment[100][6], int SAssessment[100][8])
- {
- int choice; int counter = 0; char addagain = 'a'; char redo = 'a';
- do
- {
- printf("\nWhat would you like to add?\n1- A student and his/her information.\n2- A teacher and his/her information.\n3- A class' information.\n4- A teacher's assessment.\n5- A student's assessment.\n");
- scanf("%d", &choice);
- switch (choice)
- {
- case(1):
- {
- while(1)
- {
- printf("\nPlease enter the student's ID:\n"); //could be name later if I felt like it
- scanf("%d", SInfo[counter][0]);
- printf("\nPlease enter the student's age:\n");
- scanf("%d", SInfo[counter][1]);
- printf("\nPlease enter the student's gender: (1 for Male/ 0 for Female)\n");
- scanf("%d", SInfo[counter][2]);
- printf("\nPlease enter the student's address:\n"); //it's gonna be a string later on just adding headlines
- scanf("%d", SInfo[counter][3]);
- printf("\nPlease enter the student's telephone number:\n");
- scanf("%d", SInfo[counter][4]);
- printf("please enter this student's fees' payment:\n");
- scanf("%d", SInfo[counter][5]);
- printf("\n\nWould you like to add another student's information? (Y/N)\n");
- scanf("\n%c", &addagain);
- if(addagain == 'Y' || addagain == 'y')
- {
- counter++;
- continue;
- }
- else if(addagain == 'N' || addagain == 'n')
- {
- if(counter >= 10)
- {
- counter = 0;
- break;
- }
- else
- {
- printf("Insufficient number of students were added, please add more.\n");
- continue;
- }
- }
- }
- break;
- }
- case(2):
- {
- while(1)
- {
- printf("\nPlease enter the teacher's ID:\n"); //could be name later if I felt like it
- scanf("%d", TInfo[counter][0]);
- printf("\nPlease enter the teacher's age:\n");
- scanf("%d", TInfo[counter][1]);
- printf("\nPlease enter the teacher's gender: (1 for Male/ 0 for Female)\n");
- scanf("%d", TInfo[counter][2]);
- printf("\nPlease enter the teacher's Educational Level:\n"); //it's gonna be a string later on just adding headlines
- scanf("%d", TInfo[counter][3]);
- printf("\nPlease enter the teacher's telephone number:\n");
- scanf("%d", TInfo[counter][4]);
- printf("\nPlease enter the teacher's Specialist address:\n");
- scanf("%d", TInfo[counter][5]);
- printf("Please enter the teacher's university:\n");
- scanf("%d", TInfo[counter][6]);
- printf("\n\nWould you like to add another teacher's information? (Y/N)\n");
- scanf("\n%c", &addagain);
- if(addagain == 'Y' || addagain == 'y')
- {
- counter++;
- continue;
- }
- else if(addagain == 'N' || addagain == 'n')
- break;
- }
- break;
- }
- case(3):
- {
- break;
- }
- case(4):
- {
- break;
- }
- case(5):
- {
- break;
- }
- default:
- {
- }
- printf("\nWould you like to do anything else? (Y/N)\n");
- scanf("\n%c", &redo);
- }
- while(redo == 'Y' || redo == 'y');
- }
- void modify(int SInfo[100][6], int TInfo[100][7], int CInfo[3][3], int TAssessment[100][6], int SAssessment[100][8])
- {
- int choice;
- printf("\nWhat would you like to modify?\n1- A student and his/her information.\n2- A teacher and his/her information.\n3- A class' information.\n4- A teacher's assessment.\n5- A student's assessment.\n");
- scanf("%d", &choice);
- switch (choice)
- {
- case(1):
- {
- break;
- }
- case(2):
- {
- break;
- }
- case(3):
- {
- break;
- }
- case(4):
- {
- break;
- }
- case(5):
- {
- break;
- }
- default:
- {
- }
- }
- }
- void delete(int SInfo[100][6], int TInfo[100][7], int CInfo[3][3], int TAssessment[100][6], int SAssessment[100][8])
- {
- int choice;
- printf("\nWhat would you like to delete?\n1- A student and his/her information.\n2- A teacher and his/her information.\n3- A class' information.\n4- A teacher's assessment.\n5- A student's assessment.\n");
- scanf("%d", &choice);
- switch (choice)
- {
- case(1):
- {
- break;
- }
- case(2):
- {
- break;
- }
- case(3):
- {
- break;
- }
- case(4):
- {
- break;
- }
- case(5):
- {
- break;
- }
- default:
- {
- }
- }
- }
- void assessmentteacher(int assessment[100][6])
- {
- //prints the assessment and returns nothing
- }
- void assessmentstudent(int assessment [100][8])
- {
- //prints the assessment and returns nothing
- }
- int searchstudent(int SInfo[100][6])
- {
- //it's gonna return the address
- }
- int searchteacher(int TInfo[100][7])
- {
- //WIP
- }
- void login(char user[256], char pass[256])
- {
- while (1)
- {
- printf("Please enter your username:\n");
- scanf("%s", user);
- if(user != 'admin')
- {
- printf("Invalid Username.\n");
- continue;
- }
- else if(user == 'admin')
- {
- break;
- }
- }
- while(1)
- {
- printf("\nPlease enter your password:\n");
- scanf("%s", pass);
- if(pass != '12321')
- {
- printf("Invalid Password!\n");
- continue;
- }
- else if(pass == '12321')
- {
- admin();
- }
- }
- }
- void admin()
- {
- int StudentInfo[100][6], TeacherInfo[100][7], classinfo[3][3], studentassessment[100][8], teacherassessment[100][6]; //char StName[256][256]
- int choice; char delchoice = 'a'; char search = 'a'; char searchagain = 'a'; char assessment = 'a';
- char assessmentagain = 'a'; char paymentchoice = 'a'; char redo = 'a';
- do
- {
- printf("What would you like to do?\n1- Add/Modify/Delete data.\n2- Search for a student or a teacher.\n3- Print assessment report for teacher/student.\n4- Print the payment info of a student.\n");
- scanf("%d", &choice);
- if(choice == 1)
- {
- printf("\nWhat would you like to do? (A/D/M)\n");
- scanf("\n%c", &delchoice);
- if(delchoice == 'A' || delchoice == 'a')
- {
- add(StudentInfo, TeacherInfo, classinfo, studentassessment, teacherassessment);
- }
- else if(delchoice == 'M' || delchoice == 'm')
- {
- modify(StudentInfo, TeacherInfo, classinfo, studentassessment, teacherassessment);
- }
- else if(delchoice == 'D' || delchoice == 'd')
- {
- delete(StudentInfo, TeacherInfo, classinfo, studentassessment, teacherassessment);
- }
- }
- else if(choice == 2)
- {
- do
- {
- printf("\nWhat would you like to search for? (S/T)\n");
- scanf("\n%c", &search);
- if(search == 'S' || search == 's')
- {
- searchstudent(StudentInfo);
- }
- else if(search == 'T' || search == 't')
- {
- searchteacher(TeacherInfo);
- }
- printf("\nWould you like to search for anything else? (Y/N)\n");
- scanf("\n%c", &searchagain);
- }
- while(searchagain == 'Y' || searchagain == 'y');
- }
- else if(choice == 3)
- {
- do
- {
- printf("\nWho would you like to print the assessment for? (S/T)\n");
- scanf("\n%c", &assessment);
- if(assessment == 'S' || assessment == 's')
- {
- assessmentstudent(studentassessment);
- }
- else if(assessment == 'T' || assessment == 't')
- {
- assessmentteacher(teacherassessment);
- }
- printf("\nWould you like to print another assessment? (Y/N)\n");
- scanf("\n%c", &assessmentagain);
- }
- while(assessmentagain == 'y' || assessmentagain 'Y');
- }
- else if(choice == 4)
- {
- do
- {
- payment(StudentInfo);
- printf("\nWould you like to print the payment info for another student? (Y/N)\n");
- scanf("\n%c", &paymentchoice);
- }
- while(paymentchoice == 'Y' || paymentchoice == 'y');
- }
- printf("\nWould you like to do anything else? (Y/N)\n");
- scanf("\n%c", &redo);
- }
- while(redo == 'Y' || redo == 'y');
- }
- int main()
- {
- char user[256]; char pass[256];
- login(user, pass);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement