Advertisement
Guest User

code updated

a guest
Jan 19th, 2018
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.98 KB | None | 0 0
  1. //The username and the pass for the admin are admin 12321
  2. #include <stdio.h>
  3. void payment(int SInfo[100][6])
  4. {
  5. //it's gonna print the payment info for a student chosen by the administrator
  6. }
  7. void add(int SInfo[100][6], int TInfo[100][7], int CInfo[3][3], int TAssessment[100][6], int SAssessment[100][8])
  8. {
  9. int choice; int counter = 0; char addagain = 'a'; char redo = 'a';
  10. do
  11. {
  12. 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");
  13. scanf("%d", &choice);
  14. switch (choice)
  15. {
  16. case(1):
  17. {
  18. while(1)
  19. {
  20. printf("\nPlease enter the student's ID:\n"); //could be name later if I felt like it
  21. scanf("%d", SInfo[counter][0]);
  22. printf("\nPlease enter the student's age:\n");
  23. scanf("%d", SInfo[counter][1]);
  24. printf("\nPlease enter the student's gender: (1 for Male/ 0 for Female)\n");
  25. scanf("%d", SInfo[counter][2]);
  26. printf("\nPlease enter the student's address:\n"); //it's gonna be a string later on just adding headlines
  27. scanf("%d", SInfo[counter][3]);
  28. printf("\nPlease enter the student's telephone number:\n");
  29. scanf("%d", SInfo[counter][4]);
  30. printf("please enter this student's fees' payment:\n");
  31. scanf("%d", SInfo[counter][5]);
  32. printf("\n\nWould you like to add another student's information? (Y/N)\n");
  33. scanf("\n%c", &addagain);
  34. if(addagain == 'Y' || addagain == 'y')
  35. {
  36. counter++;
  37. continue;
  38. }
  39. else if(addagain == 'N' || addagain == 'n')
  40. {
  41. if(counter >= 10)
  42. {
  43. counter = 0;
  44. break;
  45. }
  46. else
  47. {
  48. printf("Insufficient number of students were added, please add more.\n");
  49. continue;
  50. }
  51. }
  52. }
  53. break;
  54. }
  55. case(2):
  56. {
  57. while(1)
  58. {
  59. printf("\nPlease enter the teacher's ID:\n"); //could be name later if I felt like it
  60. scanf("%d", TInfo[counter][0]);
  61. printf("\nPlease enter the teacher's age:\n");
  62. scanf("%d", TInfo[counter][1]);
  63. printf("\nPlease enter the teacher's gender: (1 for Male/ 0 for Female)\n");
  64. scanf("%d", TInfo[counter][2]);
  65. printf("\nPlease enter the teacher's Educational Level:\n"); //it's gonna be a string later on just adding headlines
  66. scanf("%d", TInfo[counter][3]);
  67. printf("\nPlease enter the teacher's telephone number:\n");
  68. scanf("%d", TInfo[counter][4]);
  69. printf("\nPlease enter the teacher's Specialist address:\n");
  70. scanf("%d", TInfo[counter][5]);
  71. printf("Please enter the teacher's university:\n");
  72. scanf("%d", TInfo[counter][6]);
  73. printf("\n\nWould you like to add another teacher's information? (Y/N)\n");
  74. scanf("\n%c", &addagain);
  75. if(addagain == 'Y' || addagain == 'y')
  76. {
  77. counter++;
  78. continue;
  79. }
  80. else if(addagain == 'N' || addagain == 'n')
  81. break;
  82. }
  83. break;
  84. }
  85. case(3):
  86. {
  87. break;
  88. }
  89. case(4):
  90. {
  91. break;
  92. }
  93. case(5):
  94. {
  95. break;
  96. }
  97. default:
  98. {
  99.  
  100. }
  101. printf("\nWould you like to do anything else? (Y/N)\n");
  102. scanf("\n%c", &redo);
  103. }
  104. while(redo == 'Y' || redo == 'y');
  105. }
  106. void modify(int SInfo[100][6], int TInfo[100][7], int CInfo[3][3], int TAssessment[100][6], int SAssessment[100][8])
  107. {
  108. int choice;
  109. 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");
  110. scanf("%d", &choice);
  111. switch (choice)
  112. {
  113. case(1):
  114. {
  115.  
  116. break;
  117. }
  118. case(2):
  119. {
  120. break;
  121. }
  122. case(3):
  123. {
  124. break;
  125. }
  126. case(4):
  127. {
  128. break;
  129. }
  130. case(5):
  131. {
  132. break;
  133. }
  134. default:
  135. {
  136.  
  137. }
  138. }
  139. }
  140. void delete(int SInfo[100][6], int TInfo[100][7], int CInfo[3][3], int TAssessment[100][6], int SAssessment[100][8])
  141. {
  142. int choice;
  143. 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");
  144. scanf("%d", &choice);
  145. switch (choice)
  146. {
  147. case(1):
  148. {
  149.  
  150. break;
  151. }
  152. case(2):
  153. {
  154. break;
  155. }
  156. case(3):
  157. {
  158. break;
  159. }
  160. case(4):
  161. {
  162. break;
  163. }
  164. case(5):
  165. {
  166. break;
  167. }
  168. default:
  169. {
  170.  
  171. }
  172. }
  173. }
  174. void assessmentteacher(int assessment[100][6])
  175. {
  176. //prints the assessment and returns nothing
  177. }
  178. void assessmentstudent(int assessment [100][8])
  179. {
  180. //prints the assessment and returns nothing
  181. }
  182. int searchstudent(int SInfo[100][6])
  183. {
  184. //it's gonna return the address
  185. }
  186. int searchteacher(int TInfo[100][7])
  187. {
  188. //WIP
  189. }
  190. void login(char user[256], char pass[256])
  191. {
  192. while (1)
  193. {
  194. printf("Please enter your username:\n");
  195. scanf("%s", user);
  196. if(user != 'admin')
  197. {
  198. printf("Invalid Username.\n");
  199. continue;
  200. }
  201. else if(user == 'admin')
  202. {
  203. break;
  204. }
  205. }
  206. while(1)
  207. {
  208. printf("\nPlease enter your password:\n");
  209. scanf("%s", pass);
  210. if(pass != '12321')
  211. {
  212. printf("Invalid Password!\n");
  213. continue;
  214. }
  215. else if(pass == '12321')
  216. {
  217. admin();
  218. }
  219. }
  220. }
  221. void admin()
  222. {
  223. int StudentInfo[100][6], TeacherInfo[100][7], classinfo[3][3], studentassessment[100][8], teacherassessment[100][6]; //char StName[256][256]
  224. int choice; char delchoice = 'a'; char search = 'a'; char searchagain = 'a'; char assessment = 'a';
  225. char assessmentagain = 'a'; char paymentchoice = 'a'; char redo = 'a';
  226. do
  227. {
  228. 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");
  229. scanf("%d", &choice);
  230. if(choice == 1)
  231. {
  232. printf("\nWhat would you like to do? (A/D/M)\n");
  233. scanf("\n%c", &delchoice);
  234. if(delchoice == 'A' || delchoice == 'a')
  235. {
  236. add(StudentInfo, TeacherInfo, classinfo, studentassessment, teacherassessment);
  237. }
  238. else if(delchoice == 'M' || delchoice == 'm')
  239. {
  240. modify(StudentInfo, TeacherInfo, classinfo, studentassessment, teacherassessment);
  241. }
  242. else if(delchoice == 'D' || delchoice == 'd')
  243. {
  244. delete(StudentInfo, TeacherInfo, classinfo, studentassessment, teacherassessment);
  245. }
  246. }
  247. else if(choice == 2)
  248. {
  249. do
  250. {
  251. printf("\nWhat would you like to search for? (S/T)\n");
  252. scanf("\n%c", &search);
  253. if(search == 'S' || search == 's')
  254. {
  255. searchstudent(StudentInfo);
  256. }
  257. else if(search == 'T' || search == 't')
  258. {
  259. searchteacher(TeacherInfo);
  260. }
  261. printf("\nWould you like to search for anything else? (Y/N)\n");
  262. scanf("\n%c", &searchagain);
  263. }
  264. while(searchagain == 'Y' || searchagain == 'y');
  265. }
  266. else if(choice == 3)
  267. {
  268. do
  269. {
  270. printf("\nWho would you like to print the assessment for? (S/T)\n");
  271. scanf("\n%c", &assessment);
  272. if(assessment == 'S' || assessment == 's')
  273. {
  274. assessmentstudent(studentassessment);
  275. }
  276. else if(assessment == 'T' || assessment == 't')
  277. {
  278. assessmentteacher(teacherassessment);
  279. }
  280. printf("\nWould you like to print another assessment? (Y/N)\n");
  281. scanf("\n%c", &assessmentagain);
  282. }
  283. while(assessmentagain == 'y' || assessmentagain 'Y');
  284. }
  285. else if(choice == 4)
  286. {
  287. do
  288. {
  289. payment(StudentInfo);
  290. printf("\nWould you like to print the payment info for another student? (Y/N)\n");
  291. scanf("\n%c", &paymentchoice);
  292. }
  293. while(paymentchoice == 'Y' || paymentchoice == 'y');
  294. }
  295. printf("\nWould you like to do anything else? (Y/N)\n");
  296. scanf("\n%c", &redo);
  297. }
  298. while(redo == 'Y' || redo == 'y');
  299. }
  300. int main()
  301. {
  302. char user[256]; char pass[256];
  303. login(user, pass);
  304. return 0;
  305. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement