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])
- {
- int serialnum;
- printf("\nPlease enter the student's serial number:\n");
- scanf("%d", &serialnum);
- printf("\nThis student paid %d of his fees.\n", SInfo[serialnum][5]);
- }
- void add(int SInfo[100][6], int TInfo[100][7], int CInfo[3][3], int TAssessment[100][6], int SAssessment[100][8], char TNotes[256][256], char SNotes[256][256])
- {
- int choice; int counter = 0; char addagain = 'a'; char redo = 'a'; char othernotes = '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("\nInsufficient number of students were added, please add more.\n");
- continue;
- }
- }
- }
- break;
- }
- case 2:
- {
- counter = 0;
- 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("\nPlease enter the teacher's university:\n"); //it's gonna be a string
- 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:
- {
- for(int i = 0; i < 3; i++)
- {
- printf("\nPlease enter KG%d's teacher's ID:\n",i+1); //might make it a string
- scanf("%d", &CInfo[i][0]);
- printf("\nPlease enter KG%d's location:\n", i+1);
- scanf("%d", &CInfo[i][1]);
- printf("\nPlease enter KG%d's number of students:\n", i+1);
- scanf("%d", &CInfo[i][2]);
- }
- break;
- }
- case 4:
- {
- counter = 0;
- while(1)
- {
- printf("\nPlease enter the teacher's ID that you want to add the assessment for:\n"); //could be name later if I felt like it
- scanf("%d", &TAssessment[counter][0]);
- printf("\nPlease rate his/her teaching skills: ( ? / 10 )\n");
- scanf("%d", &TAssessment[counter][1]);
- printf("\nPlease rate his/her preparation for class: ( ? / 10 )\n");
- scanf("%d", &TAssessment[counter][2]);
- printf("\nPlease rate his/her interaction with students: ( ? / 10 )\n");
- scanf("%d", &TAssessment[counter][3]);
- printf("\nPlease rate his/her use of technology in teaching: ( ? / 10 )\n");
- scanf("%d", &TAssessment[counter][4]);
- printf("\nPlease rate his/her attendance: ( ? / 10 )\n");
- scanf("%d", &TAssessment[counter][5]);
- printf("\nOther Notes?: (Y/N)\n");
- scanf("\n%c", &othernotes);
- if(othernotes == 'Y' || othernotes == 'y')
- {
- printf("\nPlease enter your notes with each word separated with an underscore");
- scanf("%s", TNotes[counter]); // Not sure how this works I'll leave it to you saif
- }
- else
- {
- printf("\n\nWould you like to add another assessment for a teacher? (Y/N)\n");
- scanf("\n%c", &addagain);
- if(addagain == 'Y' || addagain == 'y')
- {
- counter++;
- continue;
- }
- else if(addagain == 'N' || addagain == 'n')
- break;
- }
- }
- break;
- }
- case 5:
- {
- counter = 0;
- while(1)
- {
- printf("\nPlease enter the student's ID that you want to add the assessment for:\n"); //could be name later if I felt like it
- scanf("%d", &SAssessment[counter][0]);
- printf("\nPlease rate his/her attendance: ( ? / 10 )\n");
- scanf("%d", &SAssessment[counter][1]);
- printf("\nPlease rate his/her reading level: ( ? / 10 )\n");
- scanf("%d", &SAssessment[counter][2]);
- printf("\nPlease rate his/her writing level: ( ? / 10 )\n");
- scanf("%d", &SAssessment[counter][3]);
- printf("\nPlease rate his/her participation level: ( ? / 10 )\n");
- scanf("%d", &SAssessment[counter][4]);
- printf("\nPlease enter his/her IQ result:\n");
- scanf("%d", &SAssessment[counter][5]);
- printf("\nPlease rate his/her cleaning skills:\n");
- scanf("%d", &SAssessment[counter][6]);
- printf("\nPlease rate his/her leadership skills:\n");
- scanf("%d", &SAssessment[counter][7]);
- printf("\nOther Notes?: (Y/N)\n");
- scanf("\n%c", &othernotes);
- if(othernotes == 'Y' || othernotes == 'y')
- {
- printf("\nPlease enter your notes with each word separated with an underscore");
- scanf("%s", SNotes[counter]);
- }
- else
- {
- printf("\n\nWould you like to add another assessment for a student? (Y/N)\n");
- scanf("\n%c", &addagain);
- if(addagain == 'Y' || addagain == 'y')
- {
- counter++;
- continue;
- }
- else if(addagain == 'N' || addagain == 'n')
- break;
- }
- }
- break;
- }
- default:
- {
- printf("\nInvalid input.\n\n");
- continue;
- }
- }
- 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], char TNotes[256][256], char SNotes[256][256])
- {
- int choice; int serialnum; char modifyagain = 'a'; int classnum; char othernotes = 'a'; char redo = 'a';
- do
- {
- 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:
- {
- do
- {
- printf("\nPlease enter the student's serial number:\n");
- scanf("%d", &serialnum);
- printf("\nPlease enter the student's ID:\n"); //could be name later if I felt like it
- scanf("%d", &SInfo[serialnum][0]);
- printf("\nPlease enter the student's age:\n");
- scanf("%d", &SInfo[serialnum][1]);
- printf("\nPlease enter the student's gender: (1 for Male/ 0 for Female)\n");
- scanf("%d", &SInfo[serialnum][2]);
- printf("\nPlease enter the student's address:\n"); //it's gonna be a string later on just adding headlines
- scanf("%d", &SInfo[serialnum][3]);
- printf("\nPlease enter the student's telephone number:\n");
- scanf("%d", &SInfo[serialnum][4]);
- printf("please enter this student's fees' payment:\n");
- scanf("%d", &SInfo[serialnum][5]);
- printf("\nWould you like to modify another student's information? (Y/N)\n");
- scanf("\n%c", &modifyagain);
- }
- while(modifyagain == 'Y' || modifyagain == 'y');
- break;
- }
- case 2:
- {
- do
- {
- printf("\nPlease enter the teacher's serial number:\n");
- scanf("%d", &serialnum);
- printf("\nPlease enter the teacher's ID:\n"); //could be name later if I felt like it
- scanf("%d", &TInfo[serialnum][0]);
- printf("\nPlease enter the teacher's age:\n");
- scanf("%d", &TInfo[serialnum][1]);
- printf("\nPlease enter the teacher's gender: (1 for Male/ 0 for Female)\n");
- scanf("%d", &TInfo[serialnum][2]);
- printf("\nPlease enter the teacher's Educational Level:\n"); //it's gonna be a string later on just adding headlines
- scanf("%d", &TInfo[serialnum][3]);
- printf("\nPlease enter the teacher's telephone number:\n");
- scanf("%d", &TInfo[serialnum][4]);
- printf("\nPlease enter the teacher's Specialist address:\n");
- scanf("%d", &TInfo[serialnum][5]);
- printf("\nPlease enter the teacher's university:\n"); //it's gonna be a string
- scanf("%d", &TInfo[serialnum][6]);
- printf("\nWould you like to modify another teacher's information?\n");
- scanf("\n%c", &modifyagain);
- }
- while(modifyagain == 'Y' || modifyagain == 'y');
- break;
- }
- case 3:
- {
- do
- {
- printf("\nPlease enter which KG class would you like to modify: (1/2/3)\n");
- scanf("%d", &classnum);
- printf("\nPlease enter KG%d's teacher's ID:\n",classnum); //might make it a string
- scanf("%d", &CInfo[classnum-1][0]);
- printf("\nPlease enter KG%d's location:\n", classnum);
- scanf("%d", &CInfo[classnum-1][1]);
- printf("\nPlease enter KG%d's number of students:\n", classnum);
- scanf("%d", &CInfo[classnum-1][2]);
- printf("\nWould you like to modify another class' information?\n");
- scanf("\n%c", &modifyagain);
- }
- while(modifyagain == 'Y' || modifyagain == 'y');
- break;
- }
- case 4:
- {
- while(1)
- {
- printf("\nPlease enter the serial number of the teacher you want to modify his/her assessment: (from the assessment table)\n");
- scanf("%d", &serialnum);
- printf("\nPlease enter the teacher's ID that you want to modify the assessment for:\n"); //could be name later if I felt like it
- scanf("%d", &TAssessment[serialnum][0]);
- printf("\nPlease rate his/her teaching skills: ( ? / 10 )\n");
- scanf("%d", &TAssessment[serialnum][1]);
- printf("\nPlease rate his/her preparation for class: ( ? / 10 )\n");
- scanf("%d", &TAssessment[serialnum][2]);
- printf("\nPlease rate his/her interaction with students: ( ? / 10 )\n");
- scanf("%d", &TAssessment[serialnum][3]);
- printf("\nPlease rate his/her use of technology in teaching: ( ? / 10 )\n");
- scanf("%d", &TAssessment[serialnum][4]);
- printf("\nPlease rate his/her attendance: ( ? / 10 )\n");
- scanf("%d", &TAssessment[serialnum][5]);
- scanf("\n%c", &othernotes);
- if(othernotes == 'Y' || othernotes == 'y')
- {
- printf("\nPlease enter your notes with each word separated with an underscore");
- scanf("%s", TNotes[serialnum]); // Not sure how this works I'll leave it to you saif
- }
- else
- {
- printf("\n\nWould you like to modify another assessment for a teacher? (Y/N)\n");
- scanf("\n%c", &modifyagain);
- if(modifyagain == 'Y' || modifyagain == 'y')
- {
- continue;
- }
- else if(modifyagain == 'N' || modifyagain == 'n')
- break;
- }
- }
- break;
- }
- case 5:
- {
- while(1)
- {
- printf("\nPlease enter the serial number of the student you want to modify his/her assessment: (from the assessment table)\n");
- scanf("%d", &serialnum);
- printf("\nPlease enter the student's ID that you want to modify the assessment for:\n"); //could be name later if I felt like it
- scanf("%d", &SAssessment[serialnum][0]);
- printf("\nPlease rate his/her attendance: ( ? / 10 )\n");
- scanf("%d", &SAssessment[serialnum][1]);
- printf("\nPlease rate his/her reading level: ( ? / 10 )\n");
- scanf("%d", &SAssessment[serialnum][2]);
- printf("\nPlease rate his/her writing level: ( ? / 10 )\n");
- scanf("%d", &SAssessment[serialnum][3]);
- printf("\nPlease rate his/her participation level: ( ? / 10 )\n");
- scanf("%d", &SAssessment[serialnum][4]);
- printf("\nPlease enter his/her IQ result:\n");
- scanf("%d", &SAssessment[serialnum][5]);
- printf("\nPlease rate his/her cleaning skills:\n");
- scanf("%d", &SAssessment[serialnum][6]);
- printf("\nPlease rate his/her leadership skills:\n");
- scanf("%d", &SAssessment[serialnum][7]);
- printf("\nOther Notes?: (Y/N)\n");
- scanf("\n%c", &othernotes);
- if(othernotes == 'Y' || othernotes == 'y')
- {
- printf("\nPlease enter your notes with each word separated with an underscore");
- scanf("%s", SNotes[serialnum]);
- }
- else
- {
- printf("\n\nWould you like to modify another assessment for a student? (Y/N)\n");
- scanf("\n%c", &modifyagain);
- if(modifyagain == 'Y' || modifyagain == 'y')
- {
- continue;
- }
- else if(modifyagain == 'N' || modifyagain == 'n')
- break;
- }
- }
- break;
- }
- default:
- {
- printf("\nInvalid input.\n\n");
- continue;
- }
- printf("\nWould you like to do anything else? (Y/N)\n");
- scanf("\n%c", &redo);
- }
- }
- while(redo == 'Y' || redo == 'y');
- }
- void delete(int SInfo[100][6], int TInfo[100][7], int CInfo[3][3], int TAssessment[100][6], int SAssessment[100][8], char TNotes[256][256], char SNotes[256][256])
- {
- int choice; int serialnum; char delagain = 'a'; char redo = 'a';
- do
- {
- 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:
- {
- do
- {
- printf("\nPlease enter the student's serial number:\n");
- scanf("%d", &serialnum);
- for(int i = 0; i < 6; i++)
- {
- SInfo[serialnum][i] = 0; //I replaced the arbitrary symbol with 0 because I don't know how to convert an int array to a character LOL
- }
- printf("/nWould you like to delete anything else? (Y/N)\n");
- scanf("\n%c", &delagain);
- }
- while(delagain == 'Y' || delagain == 'y');
- break;
- }
- case 2:
- {
- do
- {
- printf("\nPlease enter the teacher's serial number:\n");
- scanf("%d", &serialnum);
- for(int i = 0; i < 7; i++)
- {
- TInfo[serialnum][i] = 0;
- }
- printf("/nWould you like to delete anything else? (Y/N)\n");
- scanf("\n%c", &delagain);
- }
- while(delagain == 'Y' || delagain == 'y');
- break;
- }
- case 3:
- {
- do
- {
- printf("\nPlease enter the KG class' number: (1/2/3)\n");
- scanf("%d", &serialnum);
- for(int i = 0; i < 3; i++)
- {
- CInfo[serialnum][i] = 0;
- }
- printf("/nWould you like to delete anything else? (Y/N)\n");
- scanf("\n%c", &delagain);
- }
- while(delagain == 'Y' || delagain == 'y');
- break;
- }
- case 4:
- {
- do
- {
- printf("\nPlease enter the teacher's serial number:\n");
- scanf("%d", &serialnum);
- for(int i = 0; i < 7; i++)
- {
- TInfo[serialnum][i] = 0;
- TNotes[serialnum] = '&';
- }
- printf("/nWould you like to delete anything else? (Y/N)\n");
- scanf("\n%c", &delagain);
- }
- while(delagain == 'Y' || delagain == 'y');
- break;
- }
- case 5:
- {
- do
- {
- printf("\nPlease enter the student's serial number:\n");
- scanf("%d", &serialnum);
- for(int i = 0; i < 8; i++)
- {
- SInfo[serialnum][i] = 0;
- SNotes[i] = '&';
- }
- printf("/nWould you like to delete anything else? (Y/N)\n");
- scanf("\n%c", &delagain);
- }
- while(delagain == 'Y' || delagain == 'y');
- break;
- }
- default:
- {
- printf("\nInvalid input.\n\n");
- continue;
- }
- printf("\nWould you like to do anything else? (Y/N)\n");
- scanf("\n%c", &redo);
- }
- }
- while(redo == 'Y' || redo == 'y');
- }
- void assessmentteacher(int TAssessment[100][6], char TNotes[256][256])
- {
- int serialnum;
- printf("\nPlease enter the serial number for the teacher you want to print the assessment for:\n");
- scanf("%d", &serialnum);
- printf("\n\nName\tTeaching Skills\tPreperation for class\tInteraction with students\tUsing technology in teaching\tAttendence\tOther Notes\n");
- for(int i = 0; i < 6; i++)
- {
- printf("%d\t", TAssessment[serialnum][i]);
- }
- printf("%s\n", TNotes);
- }
- void assessmentstudent(int SAssessment [100][8], char SNotes[256][256])
- {
- int serialnum;
- printf("\nPlease enter the serial number for the student you want to print the assessment for:\n");
- scanf("%d", &serialnum);
- printf("\n\nName\tAttendence Level\tReading Level\tWriting Level\tParticipation Level\tIQ Result\tCleaning Skills\tLeadership Skills\tOther Notes\n");
- for(int i = 0; i < 8; i++)
- {
- printf("%d\t", SAssessment[serialnum][i]);
- }
- printf("%s\n", SNotes);
- }
- int searchstudent(int SInfo[100][6])
- {
- int SID; int address;
- printf("\nPlease enter the teacher's ID number:\n");
- scanf("%d", &SID);
- for(int i = 0; i < 100; i++)
- {
- if(SID == SInfo[i][1])
- return i;
- }
- }
- int searchteacher(int TInfo[100][7])
- {
- int TID; int address;
- printf("\nPlease enter the teacher's ID number:\n");
- scanf("%d", &TID);
- for(int i = 0; i < 100; i++)
- {
- if(TID == TInfo[i][1])
- return i;
- }
- }
- void login(char user[256], char pass[256])
- {
- char admin[6] = {'a','d','m','i','n'}; char password[6] = {'1','2','3','2','1'};
- 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 != password)
- {
- printf("Invalid Password!\n");
- continue;
- }
- else if(pass == password)
- {
- 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';
- char SNotes[256][256]; char TNotes[256][256];
- int searchresult; char tables = 'a';
- while(1)
- {
- 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/M/D)\n");
- scanf("\n%c", &delchoice);
- if(delchoice == 'A' || delchoice == 'a')
- {
- add(StudentInfo, TeacherInfo, classinfo, studentassessment, teacherassessment, SNotes, TNotes);
- }
- else if(delchoice == 'M' || delchoice == 'm')
- {
- modify(StudentInfo, TeacherInfo, classinfo, studentassessment, teacherassessment, SNotes, TNotes);
- }
- else if(delchoice == 'D' || delchoice == 'd')
- {
- delete(StudentInfo, TeacherInfo, classinfo, studentassessment, teacherassessment, SNotes, TNotes);
- }
- }
- 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')
- {
- searchresult = searchstudent(StudentInfo);
- printf("\nThis student's serial number is %d\n", searchresult);
- }
- else if(search == 'T' || search == 't')
- {
- searchresult = searchteacher(TeacherInfo);
- printf("\nThis teacher's serial number is %d\n", searchresult);
- }
- 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, SNotes);
- }
- else if(assessment == 'T' || assessment == 't')
- {
- assessmentteacher(teacherassessment, TNotes);
- }
- 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);
- if(redo == 'Y' || redo == 'y')
- continue;
- else
- {
- printf("\nWould you like to print the tables? (Y/N)\n");
- scanf("\n%c", &tables);
- if(tables == 'Y' || tables == 'y')
- {
- printf("\nThe students information table:\n\n");
- printf("ID\tAge\tGender\tAddress\tTelephone No.\tFee's Payment\n");
- for(int i = 0; i < 100; i++)
- {
- for(int j = 0; j < 6; j++)
- {
- printf("%d\t", StudentInfo[i][j]);
- }
- printf("\n");
- }
- printf("\n\nThe Teachers information table:\n\n");
- printf("ID\tAge\tGender\tEducational Level\tUniversity\tSpecialist Address\tTelephone No.\n");
- for(int i = 0; i < 100; i++)
- {
- for(int j = 0; j < 7; j++)
- {
- printf("%d\t", TeacherInfo[i][j]);
- }
- printf("\n");
- }
- }
- else
- break;
- }
- }
- return;
- }
- int main()
- {
- char user[256]; char pass[256];
- login(user, pass);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement