├── source files ├── Students │ ├── WTW3SV.txt │ ├── WTW4SV.txt │ └── WTW5SV.txt ├── Admin │ ├── ADMIN_LOGIN.txt │ └── ADMIN_PASSWORD.txt ├── Feedback Form │ ├── Feedback Form.txt │ └── Submitted Feedbacks │ │ └── wtw4sv.txt ├── Caesar_Cipher.h ├── Student.h ├── Independant_Functions.h ├── Independant_Functions.cpp ├── Admin.h ├── Student.cpp ├── Feedback.cpp ├── Admin.cpp └── Project_Headers.h ├── Feedback.exe ├── User's Manual.pdf ├── Developer’s Documentation.pdf ├── LICENSE └── README.md /source files/Students/WTW3SV.txt: -------------------------------------------------------------------------------- 1 | zdol6 -------------------------------------------------------------------------------- /source files/Students/WTW4SV.txt: -------------------------------------------------------------------------------- 1 | zdol7 -------------------------------------------------------------------------------- /source files/Students/WTW5SV.txt: -------------------------------------------------------------------------------- 1 | zdol8 -------------------------------------------------------------------------------- /source files/Admin/ADMIN_LOGIN.txt: -------------------------------------------------------------------------------- 1 | admin -------------------------------------------------------------------------------- /source files/Admin/ADMIN_PASSWORD.txt: -------------------------------------------------------------------------------- 1 | 45678 -------------------------------------------------------------------------------- /Feedback.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SABERGLOW/Feedback_Management_System/HEAD/Feedback.exe -------------------------------------------------------------------------------- /User's Manual.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SABERGLOW/Feedback_Management_System/HEAD/User's Manual.pdf -------------------------------------------------------------------------------- /Developer’s Documentation.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SABERGLOW/Feedback_Management_System/HEAD/Developer’s Documentation.pdf -------------------------------------------------------------------------------- /source files/Feedback Form/Feedback Form.txt: -------------------------------------------------------------------------------- 1 | 1) The objectives of the training were clearly defined . 2 | 2) Participation and interaction were encouraged . 3 | 3) The topics covered were relevant to me . 4 | 4) The content was organized and easy to follow . 5 | 5) The materials distributed were helpful . 6 | 6) This training experience will be useful in my work . 7 | 7) The trainer was knowledgeable about the training topics . 8 | 8) The trainer was well prepared . 9 | 9) The training objectives were met . 10 | 10) The time allotted for the training was sufficient . -------------------------------------------------------------------------------- /source files/Caesar_Cipher.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef CAESAR_CIPHER_H 3 | #define CAESAR_CIPHER_H 4 | 5 | #include 6 | #include 7 | 8 | class ENCRYPTION //// An abstract class for encryption, implementing Caesar Cipher Algorithm //// 9 | { 10 | public: 11 | virtual void ENCRYPT(const string& FILE_NAME) = 0; 12 | }; 13 | 14 | class DECRYPTION //// An abstract class for encryption, implementing Caesar Cipher Algorithm //// 15 | { 16 | public: 17 | virtual void DECRYPT(const string& FILE_NAME) = 0; 18 | }; 19 | #endif /* CAESAR_CIPHER_H */ -------------------------------------------------------------------------------- /source files/Feedback Form/Submitted Feedbacks/wtw4sv.txt: -------------------------------------------------------------------------------- 1 | 1) The objectives of the training were clearly defined . 2 | 1. STRONGLY AGREE 3 | 4 | 2) Participation and interaction were encouraged . 5 | 2. AGREE 6 | 7 | 3) The topics covered were relevant to me . 8 | 3. NEUTRAL 9 | 10 | 4) The content was organized and easy to follow . 11 | 4. DISAGREE 12 | 13 | 5) The materials distributed were helpful . 14 | 5. STRONGLY DISAGREE 15 | 16 | 6) This training experience will be useful in my work . 17 | 1. STRONGLY AGREE 18 | 19 | 7) The trainer was knowledgeable about the training topics . 20 | 2. AGREE 21 | 22 | 8) The trainer was well prepared . 23 | 3. NEUTRAL 24 | 25 | 9) The training objectives were met . 26 | 4. DISAGREE 27 | 28 | 10) The time allotted for the training was sufficient . 29 | 5. STRONGLY DISAGREE 30 | 31 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 Wali Ullah 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /source files/Student.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef STUDENT_H 3 | #define STUDENT_H 4 | #include "Admin.h" 5 | 6 | class STUDENT : public ADMIN 7 | { 8 | public: 9 | string STUDENT_PASSWORD; 10 | 11 | 12 | STUDENT(); //// Default Constructor //// 13 | 14 | ////////////////////////////////////////////////// LOGIN FUNCTION [OVERLOADED] ///////////////////////////////////////////////////// 15 | bool LOGIN_VALIDATION_FUNCTION(); 16 | 17 | ////////////////////////////////////////////////// STUDENT MAIN MENU ///////////////////////////////////////////////////// 18 | int STUDENT_MAIN_MENU_FUNCTION(int choice); 19 | 20 | //////////////////////////////////////// 2. FILL_OUT THE FEEDBACK FORM /////////////////////////////////////////// 21 | bool STUDENT_FILL_OUT_THE_FEEDBACK_FORM_FUNCTION(int choice); 22 | 23 | /////////////////////////////////////// 3. VIEW YOUR SUBMITTED FEEDBACK [OVERLOADED] /////////////////////////////////////////// 24 | bool PRINT_SUBMITTED_FEEDBACK_FORM(); 25 | 26 | /////////////////////////////////////// 4. CHANGE YOUR PASSWORD [OVERLOADED] /////////////////////////////////////////// 27 | void CHANGE_PASSWORD(); 28 | }; 29 | #endif /* STUDENT_H */ -------------------------------------------------------------------------------- /source files/Independant_Functions.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef INDEPENDATANT_FINCTIONS_H 3 | #define INDEPENDATANT_FINCTIONS_H 4 | 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | 12 | using namespace std; 13 | 14 | ///////////////////////////////////// CLear Console Screen ////////////////////////////////// 15 | void CLEAR_SCREEN(); 16 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 17 | 18 | ///////////////////////////////////// Exit / Terminte ////////////////////////////////// 19 | void EXIT(); 20 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 21 | 22 | //////////////////////////////////////////////// TITLE SCREEN /////////////////////////////////////////////// 23 | void TITLE(); 24 | /////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 25 | 26 | ////////////////////////////////////////////// MAIN MENU 0R EXIT ///////////////////////////////////////////// 27 | int MAIN_MENU_OR_EXIT(int choice); 28 | /////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 29 | 30 | #endif /* INDEPENDATANT_FINCTIONS_H */ 31 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [![GitHub issues](https://img.shields.io/github/issues/SABERGLOW/Feedback_Management_System)](https://github.com/SABERGLOW/Feedback_Management_System/issues) [![GitHub stars](https://img.shields.io/github/stars/SABERGLOW/Feedback_Management_System)](https://github.com/SABERGLOW/Feedback_Management_System/stargazers) [![GitHub license](https://img.shields.io/github/license/SABERGLOW/Feedback_Management_System)](https://github.com/SABERGLOW/Feedback_Management_System/blob/master/LICENSE) 2 | 3 | # Feedback Management System 4 | An object oriented C++ Program which stores and maintains course feedback provided by students. [Semester Project] 5 | 6 | 7 | # Overview: 8 | The program is designed to store and maintain data about feedbacks provided by students about courses offered by any university/educational institution. The feedback consists of various questions about the course, its content, efficiency of teaching methods, and so on. The feedback once submitted can be viewed/managed by the administrator. 9 | As a student, you can fill-out the feedback form and view your submitted feedbacks, while the administrator has much more flexibility. The abilities range from adding/removing students to adding/removing questions in feedback form. We achieve that by making use of file handling, and strings generally. But as we proceed further in this document, you will understand the full functionality of the program. 10 | 11 | 12 | # Features: 13 | The program is be capable of following functionalities: 14 | ### Administrator: 15 | * Log-in to the system using your Username/Password. 16 | * Manage the Feedback Form 17 | * View the Feedback Form 18 | * Add a New Question 19 | * Remove an Existing Question 20 | * Search in the Feedback Form 21 | 22 | * Manage Student 23 | * Check Total Number of Students 24 | * Search for a Student 25 | * Remove a Student 26 | * Add a New Student 27 | 28 | * Manage Feedbacks Submitted by Students 29 | * Check Total Number of Feedbacks Submitted 30 | * Print a Submitted Feedback 31 | * Remove a Submitted Feedback 32 | 33 | * Change your Password 34 | 35 | ### Student: 36 | * Log-in to the system using your Username/Password. 37 | * View the Feedback Form 38 | * Fill-Out the Feedback Form 39 | * View your Submitted Feedback 40 | * Change your Password 41 | 42 | # Installation: 43 | Simply run "Feedback.exe" executable file, and follow on-screen instructions. 44 | 45 | 46 | # Default Parameters: 47 | * ADMIN 48 | * Admin Username: admin 49 | * Admin Password: 45678 50 | 51 | * STUDENT 52 | * Student Username: wtw2sv 53 | * Student Password: wali2 54 | 55 | _For detailed instructions, refer to Users' Manual and Developers Documentation_ 56 | -------------------------------------------------------------------------------- /source files/Independant_Functions.cpp: -------------------------------------------------------------------------------- 1 | #include "Independant_Functions.h" 2 | 3 | ///////////////////////////////////// CLear Console Screen ////////////////////////////////// 4 | void CLEAR_SCREEN() 5 | { 6 | system("cls"); // clearing the console screen, making use of stdlib.h library 7 | } 8 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 9 | 10 | ///////////////////////////////////// Exit / Terminte //////////////////////////////////// 11 | void EXIT() 12 | { 13 | cout << "\n\n\n"; 14 | cout << " __________________________________________________\n"; 15 | cout << " | Terminating the Program in 1 second...!!! |\n"; 16 | cout << " |__________________________________________________|\n"; 17 | Sleep(1000); // waiting 1s before exiting...just for "dramatic effect" 18 | } 19 | /////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 20 | 21 | //////////////////////////////////////////////// TITLE SCREEN ////////////////////////////////////////////////// 22 | void TITLE() 23 | { 24 | cout << "\n\n"; 25 | cout << " ________________________________________________________________\n"; 26 | cout << " | COURSE FEEDBACK MANAGEMENT SYSTEM |\n"; 27 | cout << " |________________________________________________________________|\n"; 28 | cout << "\n\n\n"; 29 | } 30 | /////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 31 | 32 | ////////////////////////////////////////////// MAIN MENU 0R EXIT ////////////////////////////////////////////// 33 | int MAIN_MENU_OR_EXIT(int choice) 34 | { 35 | cout << "\n\n"; 36 | cout << " >> Please choose one of the following options:\n\n"; 37 | cout << " ____________________________________________" << endl; 38 | cout << " |1. Return to Main Menu |" << endl; 39 | cout << " |2. Exit |" << endl; 40 | { 41 | cout << "\n Answer: "; 42 | 43 | ////////////////////////////////////////////////////////// 44 | try //.... Exception Handling incase of Wrong Input ...// 45 | { ////////////////////////////////////////////////////////// 46 | cin >> choice; 47 | if ((choice == 2) || (choice == 1)) 48 | { 49 | return choice; // returning right choice... 50 | } 51 | else 52 | { 53 | throw choice; // throwing bad input for chocie... 54 | } 55 | } 56 | catch (int choice) 57 | { 58 | cout << '\a'; 59 | cin.clear(); 60 | cin.ignore(256, '\n'); 61 | choice = 0; 62 | CLEAR_SCREEN(); 63 | cout << flush; 64 | for (int i = 3; i > 0; i--) // incase of wrong input, user waits for i seconds to try again...prevents spamming... 65 | { 66 | cout << "\n\n\n"; 67 | cout << " __________________________________________________\n"; 68 | cout << " | Wrong Choice, TRY AGAIN in " << i << " seconds...!!!\n"; 69 | cout << " |__________________________________________________\n"; 70 | Sleep(1000); 71 | CLEAR_SCREEN(); 72 | } 73 | TITLE(); 74 | MAIN_MENU_OR_EXIT(choice); 75 | } 76 | } 77 | } 78 | /////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -------------------------------------------------------------------------------- /source files/Admin.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef ADMIN_H 3 | #define ADMIN_H 4 | 5 | #include "Independant_Functions.h" 6 | #include "Caesar_Cipher.h" 7 | 8 | class ADMIN: public ENCRYPTION, public DECRYPTION 9 | { 10 | string USERNAME; 11 | string PASSWORD; 12 | public: 13 | string LOWER_USERNAME; 14 | bool LOGIN_SUCCESSFUL; 15 | 16 | ADMIN(); //// Default Constructor //// 17 | 18 | void SET_USERNAME(string SET_THIS_USERNAME); //// Setter for USERNAME //// 19 | 20 | void SET_PASSWORD(string SET_THIS_PASSWORD); //// Setter for PASSWORD //// 21 | 22 | string GET_USERNAME(); //// Getter for USERNAME //// 23 | 24 | string GET_PASSWORD(); //// Getter for PASSWORD //// 25 | 26 | 27 | 28 | ////////////////////////////////////////////////// LOGIN FUNCTION ///////////////////////////////////////////////////// 29 | bool LOGIN_FUNCTION(bool ITS_ADMIN); 30 | 31 | /////////////////////////////////////// LOGIN VALIDATION FUNCTION ///////////////////////////////////////////////////// 32 | virtual bool LOGIN_VALIDATION_FUNCTION(); 33 | 34 | //////////////////////////////////////// GET USERNAME & PASSWORD FUNCTION /////////////////////////////////////////// 35 | string GET_LOGIN_DATA(const string& FILE_NAME); 36 | 37 | ////////////////////////////////////////////////// ADMIN MAIN MENU ///////////////////////////////////////////////////// 38 | int ADMIN_MAIN_MENU_FUNCTION(int choice); 39 | 40 | ////////////////////////////////////////////// 1.ADMIN MANAGE FEEDBACK FORM MENU ///////////////////////////////////////////////// 41 | int ADMIN_MANAGE_FEEDBACK_FORM_MENU_FUNCTION(int choice); 42 | 43 | ///////////////////////////////////////////// 1.1.PRINT THE FEEDBACK FORM //////////////////////////////////////////////// 44 | void PRINT_FEEDBACK_FORM(); 45 | 46 | ///////////////////////////////////////// 1.2. ADMIN EDIT FEEDBACK FORM MENU ///////////////////////////////////////////// 47 | int ADMIN_EDIT_FEEDBACK_FORM_MENU_FUNCTION(int choice); 48 | 49 | ///////////////////////////////////////// 1.2.1 ADD A NEW QUESTION //////////////////////////////////////////////////// 50 | void ADD_QUESTION(); 51 | 52 | ///////////////////////////////////////// 1.2.2 REMOVE A QUESTION //////////////////////////////////////////////////// 53 | void REMOVE_QUESTION(); 54 | 55 | ///////////////////////////////////////// 1.3 SEARCH IN FEEDBACK FORM //////////////////////////////////////////////////// 56 | bool SEARCH_IN_FEEDBACK_FORM(); 57 | 58 | ////////////////////////////////////////////// 2.ADMIN MANAGE STUDENTS MENU ///////////////////////////////////////////////// 59 | int ADMIN_MANAGE_STUDENTS_MENU_FUNCTION(int choice); 60 | 61 | //////////////////////////////////////////// 2.1.CHECK TOTAL NUMBER OF STUDENTS /////////////////////////////////////////////// 62 | void TOTAL_STUDENTS(); 63 | 64 | ////////////////////////////////////// 2.2.SEARCH A STUDENT [NEPTUN CODE] ///////////////////////////////////// 65 | void SEARCH_STUDENT(); 66 | 67 | ////////////////////////////////////// 2.3.REMOVE A STUDENT [NEPTUN CODE] ///////////////////////////////////// 68 | void REMOVE_STUDENT(); 69 | 70 | ////////////////////////////////////// 2.4.ADD A NEW STUDENT [NEPTUN CODE] ///////////////////////////////////// 71 | void ADD_STUDENT(); 72 | 73 | //////////////////////////////////////////// 3.ADMIN MANAGE SUBMITTED FEEDBACKS MENU /////////////////////////////////////////////// 74 | int ADMIN_MANAGE_SUBMITTED_FEEDBACKS_MENU_FUNCTION(int choice); 75 | 76 | //////////////////////////////////// 3.1.CHECK TOTAL NUMBER OF SUBMITTED FEEDBACKS /////////////////////////////////////// 77 | void TOTAL_SUBMITTED_FEEDBACKS(); 78 | 79 | ////////////////////////////////////// 3.2.PRINT A STUDENT'S FEEDBACK [NEPTUN CODE] ///////////////////////////////////// 80 | virtual bool PRINT_SUBMITTED_FEEDBACK_FORM(); 81 | 82 | ////////////////////////////////////// 3.3.REMOVE A STUDENT'S FEEDBACK [NEPTUN CODE] ///////////////////////////////////// 83 | void REMOVE_SUBMITTED_FEEDBACK(); 84 | 85 | /////////////////////////////////////// 4. CHANGE YOUR PASSWORD /////////////////////////////////////////// 86 | virtual void CHANGE_PASSWORD(); 87 | 88 | //////////////////////////////////////// CHECK EXISTING FILE /////////////////////////////////////////// 89 | bool CHECK_EXISTING_FILE(const string& FILE_NAME); 90 | 91 | //////////////////////////////////////// ENCRYPT /////////////////////////////////////////// 92 | void ENCRYPT(const string& FILE_NAME)override; 93 | 94 | //////////////////////////////////////// DECRYPT /////////////////////////////////////////// 95 | void DECRYPT(const string& FILE_NAME)override; 96 | }; 97 | 98 | #endif /* ADMIN_H */ 99 | 100 | -------------------------------------------------------------------------------- /source files/Student.cpp: -------------------------------------------------------------------------------- 1 | #include "Student.h" 2 | 3 | STUDENT::STUDENT() //// Default Constructor //// 4 | { 5 | LOGIN_SUCCESSFUL = false; 6 | } 7 | ////////////////////////////////////////////////// LOGIN FUNCTION [OVERLOADED] ///////////////////////////////////////////////////// 8 | bool STUDENT::LOGIN_VALIDATION_FUNCTION() 9 | { 10 | cout << "Enter your PASSWORD: " << flush; 11 | cin >> STUDENT_PASSWORD; 12 | SET_PASSWORD(STUDENT_PASSWORD); 13 | string STUDENT_FILE_PATH = "./Students/" + GET_USERNAME() + ".txt"; 14 | 15 | fstream CHECK_FILE_EXIST; 16 | CHECK_FILE_EXIST.open(STUDENT_FILE_PATH.c_str(), ios::in); 17 | 18 | if (CHECK_FILE_EXIST.is_open()) 19 | { 20 | CHECK_FILE_EXIST.close(); 21 | DECRYPT(STUDENT_FILE_PATH.c_str()); 22 | string CHECK = GET_LOGIN_DATA(STUDENT_FILE_PATH.c_str()); 23 | /////////////////////////////////////////////////////////// 24 | try //... Exception Handling incase of Unsuccessful Login ...// 25 | { ////////////////////////////////////////////////////////// 26 | if (CHECK == GET_PASSWORD()) 27 | { 28 | cout << "LOGIN SUCCESSFUL...!" << endl; 29 | LOGIN_SUCCESSFUL = true; 30 | ENCRYPT(STUDENT_FILE_PATH.c_str()); 31 | return TRUE; 32 | } 33 | else 34 | { 35 | ENCRYPT(STUDENT_FILE_PATH.c_str()); 36 | throw LOGIN_SUCCESSFUL; 37 | } 38 | } 39 | catch (bool LOGIN_SUCCESSFUL) 40 | { 41 | UNREFERENCED_PARAMETER(LOGIN_SUCCESSFUL); 42 | CLEAR_SCREEN(); 43 | cout << flush; 44 | TITLE(); 45 | cout << "login Failed, Try Again..." << endl << endl; 46 | bool ITS_STUDENT = FALSE; 47 | return FALSE; 48 | } 49 | } 50 | else 51 | { 52 | CLEAR_SCREEN(); 53 | cout << flush; 54 | TITLE(); 55 | cout << "login Failed, Try Again..." << endl << endl; 56 | bool ITS_STUDENT = FALSE; 57 | return FALSE; 58 | } 59 | } 60 | /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 61 | 62 | 63 | ////////////////////////////////////// STUDENT MAIN MENU ///////////////////////////////////////////////////// 64 | int STUDENT::STUDENT_MAIN_MENU_FUNCTION(int choice) 65 | { 66 | CLEAR_SCREEN(); 67 | TITLE(); 68 | cout << " You're now logged in as a STUDENT...." << endl << endl << endl; 69 | 70 | cout << " >> Please choose one of the following options:\n\n"; 71 | 72 | cout << " ____________________________________________" << endl; 73 | cout << " |1. View The Feedback Form |" << endl; 74 | cout << " |2. Fill_Out The Feedback Form |" << endl; 75 | cout << " |3. View Your Submitted Feedback |" << endl; 76 | cout << " |4. Change Your Password |" << endl; 77 | cout << " |5. Log_Out |" << endl; 78 | cout << " |6. Exit |" << endl; 79 | 80 | 81 | { 82 | cout << "\n Answer: "; 83 | 84 | ////////////////////////////////////////////////////////// 85 | try //.... Exception Handling incase of Wrong Input ...// 86 | { ////////////////////////////////////////////////////////// 87 | cin >> choice; 88 | if ((choice <= 6) && (choice >= 1)) 89 | { 90 | return choice; 91 | } 92 | else 93 | { 94 | throw choice; 95 | } 96 | } 97 | catch (int choice) 98 | { 99 | cout << '\a'; 100 | cin.clear(); 101 | cin.ignore(256, '\n'); 102 | choice = 0; 103 | CLEAR_SCREEN(); 104 | cout << flush; 105 | for (int i = 3; i > 0; i--) 106 | { 107 | cout << "\n\n\n"; 108 | cout << " __________________________________________________\n"; 109 | cout << " | Wrong Choice, TRY AGAIN in " << i << " seconds...!!!\n"; 110 | cout << " |__________________________________________________\n"; 111 | Sleep(1000); 112 | CLEAR_SCREEN(); 113 | } 114 | STUDENT_MAIN_MENU_FUNCTION(choice); 115 | } 116 | } 117 | } 118 | /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 119 | 120 | 121 | //////////////////////////////////////// 1. VIEW THE FEEDBACK FORM /////////////////////////////////////////// 122 | /* 123 | //.................................................................................................................. 124 | //... Using the Function from ADMIN CLASS IMPLEMENTATIONS [1.1.PRINT THE FEEDBACK FORM]............................. 125 | //.................................................................................................................. 126 | */ 127 | /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 128 | 129 | //////////////////////////////////////// 2. FILL_OUT THE FEEDBACK FORM /////////////////////////////////////////// 130 | bool STUDENT::STUDENT_FILL_OUT_THE_FEEDBACK_FORM_FUNCTION(int choice) 131 | { 132 | CLEAR_SCREEN(); 133 | TITLE(); 134 | 135 | string FILE_PATH = "./Feedback Form/Submitted Feedbacks/" + GET_USERNAME() + ".txt"; 136 | 137 | if (CHECK_EXISTING_FILE(FILE_PATH.c_str())) 138 | { 139 | cout << "\n\n\n"; 140 | cout << " __________________________________________________\n"; 141 | cout << " | FEEDBACK ALREADY SUBMITTED...! \n"; 142 | cout << " |__________________________________________________\n"; 143 | return FALSE; 144 | } 145 | 146 | string QUESTION_LINE; 147 | fstream READ_FEEDBACK_FORM; 148 | fstream WRITE_FEEDBACK_ANSWERS; 149 | READ_FEEDBACK_FORM.open("./Feedback Form/Feedback Form.txt", ios::in); 150 | WRITE_FEEDBACK_ANSWERS.open(FILE_PATH.c_str(), ios::app); 151 | { 152 | while (getline(READ_FEEDBACK_FORM, QUESTION_LINE)) 153 | { 154 | cout << QUESTION_LINE << endl << " 1. STRONGLY AGREE 2. AGREE 3. NEUTRAL 4. DISAGREE 5. STRONGLY DISAGREE" << endl; 155 | 156 | CHOICE_SELECTION: 157 | cout << endl << "ENTER A CHOICE: "; 158 | 159 | ////////////////////////////////////////////////////////// 160 | try //.... Exception Handling incase of Wrong Input ...// 161 | { ////////////////////////////////////////////////////////// 162 | cin >> choice; 163 | cout << endl; 164 | if ((choice <= 5) && (choice >= 1)) 165 | { 166 | if (choice == 1) 167 | { 168 | WRITE_FEEDBACK_ANSWERS << QUESTION_LINE << endl << " 1. STRONGLY AGREE" << endl << endl; 169 | } 170 | if (choice == 2) 171 | { 172 | WRITE_FEEDBACK_ANSWERS << QUESTION_LINE << endl << " 2. AGREE" << endl << endl; 173 | } 174 | if (choice == 3) 175 | { 176 | WRITE_FEEDBACK_ANSWERS << QUESTION_LINE << endl << " 3. NEUTRAL" << endl << endl; 177 | } 178 | if (choice == 4) 179 | { 180 | WRITE_FEEDBACK_ANSWERS << QUESTION_LINE << endl << " 4. DISAGREE" << endl << endl; 181 | } 182 | if (choice == 5) 183 | { 184 | WRITE_FEEDBACK_ANSWERS << QUESTION_LINE << endl << " 5. STRONGLY DISAGREE" << endl << endl; 185 | } 186 | } 187 | else 188 | { 189 | throw choice; 190 | } 191 | } 192 | catch (int choice) 193 | { 194 | cout << '\a'; 195 | cin.clear(); 196 | cin.ignore(256, '\n'); 197 | choice = 0; 198 | for (int i = 1; i > 0; i--) 199 | { 200 | cout << "\n\n\n"; 201 | cout << " __________________________________________________\n"; 202 | cout << " | Wrong Choice, TRY AGAIN in " << i << " seconds...!!!\n"; 203 | cout << " |__________________________________________________\n"; 204 | Sleep(1000); 205 | cout << endl << endl << " ERROR: INVALID INPUT: ENTER AGAIN: "; 206 | } 207 | goto CHOICE_SELECTION; 208 | } 209 | } 210 | } 211 | READ_FEEDBACK_FORM.close(); 212 | WRITE_FEEDBACK_ANSWERS.close(); 213 | return true; 214 | 215 | } 216 | /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 217 | 218 | 219 | /////////////////////////////////////// 3. VIEW YOUR SUBMITTED FEEDBACK [OVERLOADED] /////////////////////////////////////////// 220 | bool STUDENT::PRINT_SUBMITTED_FEEDBACK_FORM() 221 | { 222 | CLEAR_SCREEN(); 223 | TITLE(); 224 | 225 | string FILE_PATH = "./Feedback Form/Submitted Feedbacks/" + GET_USERNAME() + ".txt"; 226 | 227 | if (!CHECK_EXISTING_FILE(FILE_PATH.c_str())) 228 | { 229 | cout << "\n\n\n"; 230 | cout << " __________________________________________________\n"; 231 | cout << " | No Feedback Submitted by this student yet... \n"; 232 | cout << " |__________________________________________________\n"; 233 | return FALSE; 234 | } 235 | 236 | else 237 | { 238 | string SUBMITTED_FEEDBACK_FORM; 239 | fstream READ; 240 | READ.open(FILE_PATH.c_str(), ios::in); 241 | { 242 | while (getline(READ, SUBMITTED_FEEDBACK_FORM)) 243 | { 244 | cout << SUBMITTED_FEEDBACK_FORM << endl; 245 | } 246 | } 247 | READ.close(); 248 | return TRUE; 249 | } 250 | 251 | } 252 | /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 253 | 254 | 255 | ///////////////////////////////////// 4. CHANGE YOUR PASSWORD [OVERLOADED] /////////////////////////////////////////// 256 | void STUDENT::CHANGE_PASSWORD() 257 | { 258 | CLEAR_SCREEN(); 259 | TITLE(); 260 | cout << " ________________________________________________\n"; 261 | cout << " | CHANGE YOUR PASSWORD |\n"; 262 | cout << " |________________________________________________|\n"; 263 | cout << "\n"; 264 | 265 | string NEW_PASSWORD; 266 | cout << " >> Enter your NEW PASSWORD: "; 267 | cin >> NEW_PASSWORD; 268 | 269 | string FILE_PATH = "./Students/" + GET_USERNAME() + ".txt"; 270 | ofstream OVER_WRITE; 271 | OVER_WRITE.open(FILE_PATH.c_str()); 272 | { 273 | OVER_WRITE << NEW_PASSWORD; 274 | } 275 | OVER_WRITE.close(); 276 | ENCRYPT(FILE_PATH.c_str()); 277 | 278 | cout << " ________________________________________________\n"; 279 | cout << " | PASSWORD CHANGED SUCCESSFULLY... |\n"; 280 | cout << " |________________________________________________|\n"; 281 | cout << "\n"; 282 | 283 | 284 | } 285 | /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -------------------------------------------------------------------------------- /source files/Feedback.cpp: -------------------------------------------------------------------------------- 1 | #include "Student.h" 2 | 3 | using namespace std; 4 | 5 | bool ITS_ADMIN; 6 | bool ITS_STUDENT; 7 | int CHOICE; 8 | 9 | int main() 10 | { 11 | ADMIN ADMINISTRATOR; 12 | STUDENT STUDENT; 13 | 14 | TITLE(); 15 | LOGIN_SCREEN: 16 | 17 | ////////////////////////////////////////// ADMIN RELATED FUNCTIONS AND IMPLEMENTATIONS /////////////////////////////////////// 18 | 19 | if (ADMINISTRATOR.LOGIN_FUNCTION(ITS_ADMIN)) ///// Returns TRUE if ADMIN is trying to login ///// 20 | { 21 | if (ADMINISTRATOR.LOGIN_VALIDATION_FUNCTION())///// Returns TRUE if PASSWORD is correct ///// 22 | { 23 | ITS_ADMIN = TRUE; 24 | ITS_STUDENT = FALSE; 25 | 26 | Admin_Main_Menu: 27 | CHOICE = ADMINISTRATOR.ADMIN_MAIN_MENU_FUNCTION(CHOICE);///// Returns the choice made by user for the Main Menu ///// 28 | 29 | if (CHOICE == 1) /////..... User Selected: Manage Feedback Form .....///// 30 | { 31 | cout << flush; 32 | CHOICE = ADMINISTRATOR.ADMIN_MANAGE_FEEDBACK_FORM_MENU_FUNCTION(CHOICE); 33 | { 34 | if (CHOICE == 1) /////..... User Selected: View Feedback Form .....///// 35 | { 36 | CLEAR_SCREEN(); 37 | cout << flush; 38 | TITLE(); 39 | ADMINISTRATOR.PRINT_FEEDBACK_FORM(); 40 | CHOICE = MAIN_MENU_OR_EXIT(CHOICE); 41 | { 42 | if (CHOICE == 1)/////..... User Selected: Return to Main Menu .....///// 43 | { 44 | goto Admin_Main_Menu; 45 | } 46 | else////////......... User Selected: Exit .........//////// 47 | { 48 | CHOICE = 0; 49 | EXIT(); 50 | } 51 | } 52 | } 53 | if (CHOICE == 2) /////..... User Selected: Edit Feedback Form .....///// 54 | { 55 | cout << flush; 56 | CHOICE = ADMINISTRATOR.ADMIN_EDIT_FEEDBACK_FORM_MENU_FUNCTION(CHOICE); 57 | if(CHOICE == 1)/////..... User Selected: Add A New Question .....///// 58 | { 59 | ADMINISTRATOR.ADD_QUESTION(); 60 | CHOICE = 0; 61 | CHOICE = MAIN_MENU_OR_EXIT(CHOICE); 62 | { 63 | if (CHOICE == 1)/////..... User Selected: Return to Main Menu .....///// 64 | { 65 | goto Admin_Main_Menu; 66 | } 67 | else////////......... User Selected: Exit .........//////// 68 | { 69 | CHOICE = 0; 70 | EXIT(); 71 | } 72 | } 73 | } 74 | if(CHOICE == 2)/////..... User Selected: Remove A Question .....///// 75 | { 76 | ADMINISTRATOR.REMOVE_QUESTION(); 77 | CHOICE = MAIN_MENU_OR_EXIT(CHOICE); 78 | { 79 | if (CHOICE == 1)/////..... User Selected: Return to Main Menu .....///// 80 | { 81 | goto Admin_Main_Menu; 82 | } 83 | else////////......... User Selected: Exit .........//////// 84 | { 85 | CHOICE = 0; 86 | EXIT(); 87 | } 88 | } 89 | } 90 | if (CHOICE == 3)/////..... User Selected: Return to Main Menu .....///// 91 | { 92 | goto Admin_Main_Menu; 93 | } 94 | if (CHOICE == 4)////////......... User Selected: Exit .........//////// 95 | { 96 | EXIT(); 97 | } 98 | } 99 | if (CHOICE == 3) /////..... User Selected: Search Feedback Form .....///// 100 | { 101 | CLEAR_SCREEN(); 102 | cout << flush; 103 | TITLE(); 104 | if(ADMINISTRATOR.SEARCH_IN_FEEDBACK_FORM()) 105 | { 106 | cout << " __________________________________________________\n"; 107 | cout << " | QUERY FOUND...!!! |\n"; 108 | cout << " |__________________________________________________|\n"; 109 | cout << "\n"; 110 | } 111 | else 112 | { 113 | cout << " __________________________________________________\n"; 114 | cout << " | Your Query doesn't exist in the Feedback Form |\n"; 115 | cout << " |__________________________________________________|\n"; 116 | cout << "\n"; 117 | } 118 | 119 | CHOICE = MAIN_MENU_OR_EXIT(CHOICE); 120 | { 121 | if (CHOICE == 1)/////..... User Selected: Return to Main Menu .....///// 122 | { 123 | goto Admin_Main_Menu; 124 | } 125 | else////////......... User Selected: Exit .........//////// 126 | { 127 | CHOICE = 0; 128 | EXIT(); 129 | } 130 | } 131 | } 132 | if (CHOICE == 4)/////..... User Selected: Return to Main Menu .....///// 133 | { 134 | goto Admin_Main_Menu; 135 | } 136 | if (CHOICE == 5)////////......... User Selected: Exit .........//////// 137 | { 138 | EXIT(); 139 | } 140 | } 141 | } 142 | if (CHOICE == 2)/////..... User Selected: Manage Students .....///// 143 | { 144 | cout << flush; 145 | CHOICE = ADMINISTRATOR.ADMIN_MANAGE_STUDENTS_MENU_FUNCTION(CHOICE); 146 | { 147 | if (CHOICE == 1)/////..... User Selected: Check Total Number of Students.....///// 148 | { 149 | ADMINISTRATOR.TOTAL_STUDENTS(); 150 | CHOICE = MAIN_MENU_OR_EXIT(CHOICE); 151 | { 152 | if (CHOICE == 1)/////..... User Selected: Return to Main Menu .....///// 153 | { 154 | goto Admin_Main_Menu; 155 | } 156 | else////////......... User Selected: Exit .........//////// 157 | { 158 | CHOICE = 0; 159 | EXIT(); 160 | } 161 | } 162 | } 163 | if (CHOICE == 2)/////..... User Selected: Search A Student [NEPTUN CODE].....///// 164 | { 165 | ADMINISTRATOR.SEARCH_STUDENT(); 166 | CHOICE = MAIN_MENU_OR_EXIT(CHOICE); 167 | { 168 | if (CHOICE == 1)/////..... User Selected: Return to Main Menu .....///// 169 | { 170 | goto Admin_Main_Menu; 171 | } 172 | else////////......... User Selected: Exit .........//////// 173 | { 174 | CHOICE = 0; 175 | EXIT(); 176 | } 177 | } 178 | } 179 | if (CHOICE == 3)/////..... User Selected: Remove A Student [NEPTUN CODE].....///// 180 | { 181 | ADMINISTRATOR.REMOVE_STUDENT(); 182 | CHOICE = MAIN_MENU_OR_EXIT(CHOICE); 183 | { 184 | if (CHOICE == 1)/////..... User Selected: Return to Main Menu .....///// 185 | { 186 | goto Admin_Main_Menu; 187 | } 188 | else////////......... User Selected: Exit .........//////// 189 | { 190 | CHOICE = 0; 191 | EXIT(); 192 | } 193 | } 194 | } 195 | if (CHOICE == 4)/////..... User Selected: Add A New Student [NEPTUN CODE].....///// 196 | { 197 | ADMINISTRATOR.ADD_STUDENT(); 198 | CHOICE = MAIN_MENU_OR_EXIT(CHOICE); 199 | { 200 | if (CHOICE == 1)/////..... User Selected: Return to Main Menu .....///// 201 | { 202 | goto Admin_Main_Menu; 203 | } 204 | else////////......... User Selected: Exit .........//////// 205 | { 206 | CHOICE = 0; 207 | EXIT(); 208 | } 209 | } 210 | } 211 | if (CHOICE == 5)/////..... User Selected: Return to Main Menu .....///// 212 | { 213 | goto Admin_Main_Menu; 214 | } 215 | if (CHOICE == 6)////////......... User Selected: Exit .........//////// 216 | { 217 | EXIT(); 218 | } 219 | } 220 | } 221 | if (CHOICE == 3)//.....User Selected: Manage Submitted Feedbacks...../// 222 | { 223 | CLEAR_SCREEN(); 224 | cout << flush; 225 | TITLE(); 226 | CHOICE = ADMINISTRATOR.ADMIN_MANAGE_SUBMITTED_FEEDBACKS_MENU_FUNCTION(CHOICE); 227 | { 228 | if (CHOICE == 1)/////..... User Selected: Check Total Number of Submitted Feedbacks .....///// 229 | { 230 | ADMINISTRATOR.TOTAL_SUBMITTED_FEEDBACKS(); 231 | CHOICE = MAIN_MENU_OR_EXIT(CHOICE); 232 | { 233 | if (CHOICE == 1)/////..... User Selected: Return to Main Menu .....///// 234 | { 235 | goto Admin_Main_Menu; 236 | } 237 | else////////......... User Selected: Exit .........//////// 238 | { 239 | CHOICE = 0; 240 | EXIT(); 241 | } 242 | } 243 | } 244 | if (CHOICE == 2)////////......... User Selected: Print A Student's Feedback .........//////// 245 | { 246 | if (!ADMINISTRATOR.PRINT_SUBMITTED_FEEDBACK_FORM())//...........The feedback wasn't submitted yet... 247 | { 248 | CHOICE = MAIN_MENU_OR_EXIT(CHOICE); 249 | { 250 | if (CHOICE == 1)/////..... User Selected: Return to Main Menu .....///// 251 | { 252 | goto Admin_Main_Menu; 253 | } 254 | else////////......... User Selected: Exit .........//////// 255 | { 256 | EXIT(); 257 | } 258 | } 259 | } 260 | else 261 | { 262 | CHOICE = MAIN_MENU_OR_EXIT(CHOICE); 263 | { 264 | if (CHOICE == 1)/////..... User Selected: Return to Main Menu .....///// 265 | { 266 | goto Admin_Main_Menu; 267 | } 268 | else////////......... User Selected: Exit .........//////// 269 | { 270 | EXIT(); 271 | } 272 | } 273 | } 274 | 275 | } 276 | if (CHOICE == 3)/////..... User Selected: Remove A Student's Feedback .....///// 277 | { 278 | ADMINISTRATOR.REMOVE_SUBMITTED_FEEDBACK(); 279 | CHOICE = MAIN_MENU_OR_EXIT(CHOICE); 280 | { 281 | if (CHOICE == 1)/////..... User Selected: Return to Main Menu .....///// 282 | { 283 | goto Admin_Main_Menu; 284 | } 285 | else////////......... User Selected: Exit .........//////// 286 | { 287 | CHOICE = 0; 288 | EXIT(); 289 | } 290 | } 291 | } 292 | if (CHOICE == 4)/////..... User Selected: Return to Main Menu .....///// 293 | { 294 | goto Admin_Main_Menu; 295 | } 296 | if (CHOICE == 5)////////......... User Selected: Exit .........//////// 297 | { 298 | EXIT(); 299 | } 300 | } 301 | } 302 | if (CHOICE == 4)/////..... User Selected: Change Your Password .....///// 303 | { 304 | ADMINISTRATOR.CHANGE_PASSWORD(); 305 | CHOICE = MAIN_MENU_OR_EXIT(CHOICE); 306 | { 307 | if (CHOICE == 1)/////..... User Selected: Return to Main Menu .....///// 308 | { 309 | goto Admin_Main_Menu; 310 | } 311 | else////////......... User Selected: Exit .........//////// 312 | { 313 | CHOICE = 0; 314 | EXIT(); 315 | } 316 | } 317 | } 318 | if (CHOICE == 5)/////..... User Selected: Log Out .....///// 319 | { 320 | CLEAR_SCREEN(); 321 | TITLE(); 322 | goto LOGIN_SCREEN; 323 | } 324 | if (CHOICE == 6)////////......... User Selected: Exit .........//////// 325 | { 326 | EXIT(); 327 | } 328 | 329 | } 330 | else 331 | { 332 | goto LOGIN_SCREEN; //....... Incase the Password wasn't correct, we move back to LOGIN screen.....// 333 | } 334 | 335 | } 336 | /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 337 | 338 | ////////////////////////////////////////// STUDENT RELATED FUNCTIONS AND IMPLEMENTATIONS ///////////////////////////////////// 339 | else 340 | { 341 | STUDENT.SET_USERNAME(ADMINISTRATOR.GET_USERNAME()); //// If USERNAME wasn't "ADMIN", then obviously it's a Student...//// 342 | 343 | if (STUDENT.LOGIN_VALIDATION_FUNCTION()) /////...................... Returns TRUE if PASSWORD is correct ///// 344 | { 345 | ITS_ADMIN = FALSE; 346 | ITS_STUDENT = TRUE; 347 | 348 | Student_Main_Menu: 349 | CHOICE = STUDENT.STUDENT_MAIN_MENU_FUNCTION(CHOICE); 350 | 351 | if (CHOICE == 1) /////..... User Selected: View Feedback Form .....///// 352 | { 353 | CLEAR_SCREEN(); 354 | cout << flush; 355 | TITLE(); 356 | ADMINISTRATOR.PRINT_FEEDBACK_FORM(); 357 | CHOICE = MAIN_MENU_OR_EXIT(CHOICE); 358 | { 359 | if (CHOICE == 1)/////..... User Selected: Return to Main Menu .....///// 360 | { 361 | goto Student_Main_Menu; 362 | } 363 | else////////......... User Selected: Exit .........//////// 364 | { 365 | CHOICE = 0; 366 | EXIT(); 367 | } 368 | } 369 | 370 | 371 | } 372 | if (CHOICE == 2)///... User Selected: Fill_Out The Feedback Form .../// 373 | { 374 | if (!STUDENT.STUDENT_FILL_OUT_THE_FEEDBACK_FORM_FUNCTION(CHOICE))//...........The feedback was already submitted... 375 | { 376 | CHOICE = MAIN_MENU_OR_EXIT(CHOICE); 377 | { 378 | if (CHOICE == 1)/////..... User Selected: Return to Main Menu .....///// 379 | { 380 | goto Student_Main_Menu; 381 | } 382 | else////////......... User Selected: Exit .........//////// 383 | { 384 | EXIT(); 385 | } 386 | } 387 | } 388 | else 389 | { 390 | CHOICE = MAIN_MENU_OR_EXIT(CHOICE); 391 | { 392 | if (CHOICE == 1)/////..... User Selected: Return to Main Menu .....///// 393 | { 394 | goto Student_Main_Menu; 395 | } 396 | else////////......... User Selected: Exit .........//////// 397 | { 398 | EXIT(); 399 | } 400 | } 401 | } 402 | 403 | } 404 | if (CHOICE == 3)//... User Selected: View Your Submitted Feedback ../// 405 | { 406 | if (!STUDENT.PRINT_SUBMITTED_FEEDBACK_FORM())//...........The feedback wasn't submitted yet... 407 | { 408 | CHOICE = MAIN_MENU_OR_EXIT(CHOICE); 409 | { 410 | if (CHOICE == 1)/////..... User Selected: Return to Main Menu .....///// 411 | { 412 | goto Student_Main_Menu; 413 | } 414 | else////////......... User Selected: Exit .........//////// 415 | { 416 | EXIT(); 417 | } 418 | } 419 | } 420 | else 421 | { 422 | CHOICE = MAIN_MENU_OR_EXIT(CHOICE); 423 | { 424 | if (CHOICE == 1)/////..... User Selected: Return to Main Menu .....///// 425 | { 426 | goto Student_Main_Menu; 427 | } 428 | else////////......... User Selected: Exit .........//////// 429 | { 430 | EXIT(); 431 | } 432 | } 433 | } 434 | } 435 | if (CHOICE == 4)/////..... User Selected: Change Your Password .....///// 436 | { 437 | STUDENT.CHANGE_PASSWORD(); 438 | CHOICE = MAIN_MENU_OR_EXIT(CHOICE); 439 | { 440 | if (CHOICE == 1)/////..... User Selected: Return to Main Menu .....///// 441 | { 442 | goto Student_Main_Menu; 443 | } 444 | else////////......... User Selected: Exit .........//////// 445 | { 446 | CHOICE = 0; 447 | EXIT(); 448 | } 449 | } 450 | } 451 | if (CHOICE == 5)/////..... User Selected: Log Out .....///// 452 | { 453 | CLEAR_SCREEN(); 454 | TITLE(); 455 | goto LOGIN_SCREEN; 456 | } 457 | if (CHOICE == 6)////////......... User Selected: Exit .........//////// 458 | { 459 | EXIT(); 460 | } 461 | } 462 | else 463 | { 464 | goto LOGIN_SCREEN; //......... Incase the Password wasn't correct, we move back to LOGIN screen....// 465 | } 466 | } 467 | /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 468 | 469 | //system("pause"); 470 | 471 | return 0; 472 | } -------------------------------------------------------------------------------- /source files/Admin.cpp: -------------------------------------------------------------------------------- 1 | #include "Admin.h" 2 | 3 | ADMIN::ADMIN() //// Default Constructor //// 4 | { 5 | LOGIN_SUCCESSFUL = false; 6 | } 7 | void ADMIN::SET_USERNAME(string SET_THIS_USERNAME) //// Setter for USERNAME //// 8 | { 9 | USERNAME = SET_THIS_USERNAME; 10 | } 11 | string ADMIN::GET_USERNAME() //// Getter for USERNAME //// 12 | { 13 | return USERNAME; 14 | } 15 | 16 | void ADMIN::SET_PASSWORD(string SET_THIS_PASSWORD) //// Setter for PASSWORD //// 17 | { 18 | PASSWORD = SET_THIS_PASSWORD; 19 | } 20 | string ADMIN::GET_PASSWORD() //// Getter for PASSWORD //// 21 | { 22 | return PASSWORD; 23 | } 24 | 25 | ////////////////////////////////////////////////// LOGIN FUNCTION ///////////////////////////////////////////////////// 26 | bool ADMIN::LOGIN_FUNCTION(bool ITS_ADMIN) 27 | { 28 | cout << "Enter your LOGIN: " << flush; 29 | cin >> USERNAME; 30 | 31 | LOWER_USERNAME = USERNAME; 32 | transform(LOWER_USERNAME.begin(), LOWER_USERNAME.end(), LOWER_USERNAME.begin(), ::tolower); //...function to convert string into lowercase 33 | if (LOWER_USERNAME == "admin") //... makes it easier to match UPPERCASE+LOWERCASE user inputs 34 | { 35 | ITS_ADMIN = TRUE; 36 | return ITS_ADMIN; 37 | } 38 | else 39 | { 40 | ITS_ADMIN = FALSE; 41 | return ITS_ADMIN; 42 | } 43 | } 44 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 45 | 46 | 47 | /////////////////////////////////////// LOGIN VALIDATION FUNCTION ///////////////////////////////////////////////////// 48 | bool ADMIN::LOGIN_VALIDATION_FUNCTION() 49 | { 50 | cout << "Enter your PASSWORD: " << flush; 51 | cin >> PASSWORD; 52 | string ADMIN_FILE_PATH = "./Admin/ADMIN_LOGIN.txt"; 53 | string CHECK = GET_LOGIN_DATA(ADMIN_FILE_PATH.c_str()); //...this function returns with a line [password] from ADMIN file....// 54 | /////////////////////////////////////////////////////////// 55 | try //... Exception Handling incase of Unsuccessful Login ...// 56 | { ////////////////////////////////////////////////////////// 57 | if (CHECK == USERNAME) 58 | { 59 | ADMIN_FILE_PATH = "./Admin/ADMIN_PASSWORD.txt"; 60 | DECRYPT(ADMIN_FILE_PATH.c_str()); //... calling the decrypt function, so we can match the password...// 61 | CHECK = GET_LOGIN_DATA(ADMIN_FILE_PATH.c_str()); //...this function returns with a line [password] from ADMIN file....// 62 | if (CHECK == PASSWORD) 63 | { 64 | cout << "LOGIN SUCCESSFUL...!" << endl; 65 | LOGIN_SUCCESSFUL = true; 66 | ENCRYPT(ADMIN_FILE_PATH.c_str()); //...encrypting the password...// 67 | return TRUE; 68 | } 69 | else 70 | { 71 | ENCRYPT(ADMIN_FILE_PATH.c_str()); //...if the login fails [wrong password], we still encrypt the password...// 72 | throw LOGIN_SUCCESSFUL; 73 | } 74 | } 75 | else 76 | { 77 | throw LOGIN_SUCCESSFUL; //...USERNAME != admin, so it might be a student, or bad username input...// 78 | } 79 | } 80 | catch (bool LOGIN_SUCCESSFUL) 81 | { 82 | UNREFERENCED_PARAMETER(LOGIN_SUCCESSFUL); //...catching the bool was resulting in some warnings, and this is the solution I found online...// 83 | CLEAR_SCREEN(); 84 | cout << flush; 85 | TITLE(); 86 | cout << "login Failed, Try Again..." << endl << endl; 87 | bool ITS_ADMIN = FALSE; 88 | return FALSE; 89 | } 90 | } 91 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 92 | 93 | 94 | //////////////////////////////////////// GET USERNAME & PASSWORD FUNCTION /////////////////////////////////////////// 95 | string ADMIN::GET_LOGIN_DATA(const string& FILE_NAME) 96 | { 97 | string LINE; 98 | fstream READ; 99 | READ.open(FILE_NAME.c_str(), ios::in); 100 | { 101 | if (READ.is_open()) //...file exists = TRUE...// 102 | { 103 | getline(READ, LINE); //...reads a line from the file [username/password]...// 104 | } 105 | } 106 | READ.close(); 107 | return LINE; //...returning the read data...// 108 | } 109 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 110 | 111 | 112 | ////////////////////////////////////////////////// ADMIN MAIN MENU ///////////////////////////////////////////////////// 113 | int ADMIN::ADMIN_MAIN_MENU_FUNCTION(int choice) 114 | { 115 | CLEAR_SCREEN(); 116 | TITLE(); 117 | cout << " You're now logged in as an ADMINISTRATOR...." << endl << endl << endl; 118 | 119 | cout << " >> Please choose one of the following options:\n\n"; 120 | 121 | cout << " ____________________________________________" << endl; 122 | cout << " |1. Manage Feedback Form |" << endl; 123 | cout << " |2. Manage Students |" << endl; 124 | cout << " |3. Manage Submitted Feedbacks |" << endl; 125 | cout << " |4. Change Your Password |" << endl; 126 | cout << " |5. Log-Out |" << endl; 127 | cout << " |6. Exit |" << endl; 128 | { 129 | cout << "\n Answer: "; 130 | 131 | ////////////////////////////////////////////////////////// 132 | try //.... Exception Handling incase of Wrong Input ...// 133 | { ////////////////////////////////////////////////////////// 134 | cin >> choice; 135 | if ((choice <= 6) && (choice >= 1)) //...the choice is within the range...// 136 | { 137 | return choice; 138 | } 139 | else 140 | { 141 | throw choice; 142 | } 143 | } 144 | catch (int choice) 145 | { 146 | cout << '\a'; 147 | cin.clear(); 148 | cin.ignore(256, '\n'); 149 | choice = 0; 150 | CLEAR_SCREEN(); 151 | cout << flush; 152 | for (int i = 3; i > 0; i--) 153 | { 154 | cout << "\n\n\n"; 155 | cout << " __________________________________________________\n"; 156 | cout << " | Wrong Choice, TRY AGAIN in " << i << " seconds...!!!\n"; 157 | cout << " |__________________________________________________\n"; 158 | Sleep(1000); 159 | CLEAR_SCREEN(); 160 | } 161 | ADMIN_MAIN_MENU_FUNCTION(choice); 162 | } 163 | } 164 | } 165 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 166 | 167 | 168 | ////////////////////////////////////////////// 1.ADMIN MANAGE FEEDBACK FORM MENU ///////////////////////////////////////////////// 169 | int ADMIN::ADMIN_MANAGE_FEEDBACK_FORM_MENU_FUNCTION(int choice) 170 | { 171 | CLEAR_SCREEN(); 172 | TITLE(); 173 | 174 | cout << " >> Please choose one of the following options:\n\n"; 175 | 176 | cout << " ____________________________________________" << endl; 177 | cout << " |1. Print Feedback Form |" << endl; 178 | cout << " |2. Edit Feedback Form |" << endl; 179 | cout << " |3. Search Feedback Form |" << endl; 180 | cout << " |4. Return to Main Menu |" << endl; 181 | cout << " |5. Exit |" << endl; 182 | { 183 | cout << "\n Answer: "; 184 | 185 | ////////////////////////////////////////////////////////// 186 | try //.... Exception Handling incase of Wrong Input ...// 187 | { ////////////////////////////////////////////////////////// 188 | cin >> choice; 189 | if ((choice <= 5) && (choice >= 1)) 190 | { 191 | return choice; 192 | } 193 | else 194 | { 195 | throw choice; 196 | } 197 | } 198 | catch (int choice) 199 | { 200 | cout << '\a'; 201 | cin.clear(); 202 | cin.ignore(256, '\n'); 203 | choice = 0; 204 | CLEAR_SCREEN(); 205 | cout << flush; 206 | for (int i = 3; i > 0; i--) 207 | { 208 | cout << "\n\n\n"; 209 | cout << " __________________________________________________\n"; 210 | cout << " | Wrong Choice, TRY AGAIN in " << i << " seconds...!!!\n"; 211 | cout << " |__________________________________________________\n"; 212 | Sleep(1000); 213 | CLEAR_SCREEN(); 214 | } 215 | ADMIN_MANAGE_FEEDBACK_FORM_MENU_FUNCTION(choice); 216 | } 217 | } 218 | } 219 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 220 | 221 | 222 | ///////////////////////////////////////////// 1.1.PRINT THE FEEDBACK FORM //////////////////////////////////////////////// 223 | void ADMIN::PRINT_FEEDBACK_FORM() 224 | { 225 | cout << " _________________________________\n"; 226 | cout << " | FEEDBACK FORM |\n"; 227 | cout << " |_________________________________|\n"; 228 | cout << "\n"; 229 | string* FEEDBACK_FORM; 230 | int LINE_COUNT = 0; 231 | int COUNTER = 0; 232 | 233 | fstream READ; 234 | string READ_LINE; 235 | READ.open("./Feedback Form/Feedback Form.txt", ios::in); 236 | { 237 | while (getline(READ, READ_LINE)) 238 | { 239 | LINE_COUNT++; 240 | } 241 | } 242 | READ.close(); 243 | /////////////////////////////////////////////////////////////////////////////// 244 | FEEDBACK_FORM = new string[LINE_COUNT];//...Dynamic String Array that has element number = lines in feedback form...// 245 | //... [each line has one question, hence each index will carry one question]..// 246 | 247 | READ.open("./Feedback Form/Feedback Form.txt", ios::in); 248 | { 249 | while (getline(READ, READ_LINE)) 250 | { 251 | FEEDBACK_FORM[COUNTER] = READ_LINE; 252 | COUNTER++; 253 | } 254 | } 255 | READ.close(); 256 | 257 | for (int i = 0; i < LINE_COUNT; i++) 258 | { 259 | cout << FEEDBACK_FORM[i] << endl; 260 | } 261 | delete[]FEEDBACK_FORM; 262 | } 263 | ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 264 | 265 | ///////////////////////////////////////// 1.2. ADMIN EDIT FEEDBACK FORM MENU ///////////////////////////////////////////// 266 | int ADMIN::ADMIN_EDIT_FEEDBACK_FORM_MENU_FUNCTION(int choice) 267 | { 268 | CLEAR_SCREEN(); 269 | TITLE(); 270 | cout << " ________________________________________________\n"; 271 | cout << " | EDIT FEEDBACK FORM |\n"; 272 | cout << " |________________________________________________|\n"; 273 | cout << "\n"; 274 | 275 | cout << " >> Please choose one of the following options:\n\n"; 276 | 277 | cout << " ____________________________________________" << endl; 278 | cout << " |1. Add A New Question |" << endl; 279 | cout << " |2. Remove A Question |" << endl; 280 | cout << " |3. Return to Main Menu |" << endl; 281 | cout << " |4. Exit |" << endl; 282 | { 283 | cout << "\n Answer: "; 284 | 285 | ////////////////////////////////////////////////////////// 286 | try //.... Exception Handling incase of Wrong Input ...// 287 | { ////////////////////////////////////////////////////////// 288 | cin >> choice; 289 | if ((choice <= 4) && (choice >= 1)) 290 | { 291 | return choice; 292 | } 293 | else 294 | { 295 | throw choice; 296 | } 297 | } 298 | catch (int choice) 299 | { 300 | cout << '\a'; 301 | cin.clear(); 302 | cin.ignore(256, '\n'); 303 | choice = 0; 304 | CLEAR_SCREEN(); 305 | cout << flush; 306 | for (int i = 3; i > 0; i--) 307 | { 308 | cout << "\n\n\n"; 309 | cout << " __________________________________________________\n"; 310 | cout << " | Wrong Choice, TRY AGAIN in " << i << " seconds...!!!\n"; 311 | cout << " |__________________________________________________\n"; 312 | Sleep(1000); 313 | CLEAR_SCREEN(); 314 | } 315 | ADMIN_EDIT_FEEDBACK_FORM_MENU_FUNCTION(choice); 316 | } 317 | } 318 | } 319 | /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 320 | 321 | 322 | ///////////////////////////////////////// 1.2.1 ADD A NEW QUESTION //////////////////////////////////////////////////// 323 | void ADMIN::ADD_QUESTION() 324 | { 325 | CLEAR_SCREEN(); 326 | TITLE(); 327 | cout << " __________________________________________________\n"; 328 | cout << " | ADD A NEW QUESTION |\n"; 329 | cout << " |__________________________________________________|\n"; 330 | cout << "\n"; 331 | 332 | string QUESTION; 333 | cout << " Enter The NEW QUESTION: "; 334 | cin.ignore(); 335 | getline(cin, QUESTION); //... reading the new question in a new line .../// 336 | 337 | fstream READ; 338 | string READ_LINE; 339 | int LINE_COUNT = 0; 340 | READ.open("./Feedback Form/Feedback Form.txt", ios::in); 341 | { 342 | while (getline(READ, READ_LINE)) 343 | { 344 | LINE_COUNT++; 345 | } 346 | } 347 | READ.close(); 348 | 349 | QUESTION = to_string(LINE_COUNT + 1) + ") " + QUESTION; //... adding numeric identifier to the new question...// 350 | 351 | READ.open("./Feedback Form/Feedback Form.txt", ios::app); 352 | { 353 | READ << endl << QUESTION; //... writing the new question add by the user into the file...// 354 | } 355 | READ.close(); 356 | 357 | cout << " __________________________________________________\n"; 358 | cout << " | NEW QUESTION ADDED SUCCESSFULLY... |\n"; 359 | cout << " |__________________________________________________|\n"; 360 | cout << "\n"; 361 | } 362 | /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 363 | 364 | 365 | ///////////////////////////////////////// 1.2.2 REMOVE A QUESTION //////////////////////////////////////////////////// 366 | void ADMIN::REMOVE_QUESTION() 367 | { 368 | CLEAR_SCREEN(); 369 | TITLE(); 370 | cout << " __________________________________________________\n"; 371 | cout << " | REMOVE A QUESTION |\n"; 372 | cout << " |__________________________________________________|\n"; 373 | cout << "\n"; 374 | 375 | int QUESTION; 376 | cout << " Enter the Question Number that you want to remove: "; 377 | 378 | fstream READ; 379 | string READ_LINE; 380 | int LINE_COUNT = 0; 381 | READ.open("./Feedback Form/Feedback Form.txt", ios::in); 382 | { 383 | while (getline(READ, READ_LINE)) 384 | { 385 | LINE_COUNT++; 386 | } 387 | } 388 | READ.close(); 389 | 390 | ////////////////////////////////////////////////////////// 391 | try //.... Exception Handling incase of Wrong Input ...// 392 | { ////////////////////////////////////////////////////////// 393 | cin >> QUESTION; 394 | if ((QUESTION <= LINE_COUNT) && (QUESTION >= 1)) 395 | { 396 | string* FEEDBACK_FORM; 397 | int COUNTER = 0; 398 | /////////////////////////////////////////////////////////////////////////////// 399 | FEEDBACK_FORM = new string[LINE_COUNT]; //...Dynamic String Array that has element number = lines in feedback form...// 400 | //... [each line has one question, hence each index will carry one question]..// 401 | READ.open("./Feedback Form/Feedback Form.txt", ios::in); 402 | { 403 | while (getline(READ, READ_LINE)) 404 | { 405 | if ((COUNTER + 1) != QUESTION) 406 | { 407 | FEEDBACK_FORM[COUNTER] = READ_LINE; //... reading all the questions except the one we want to remove...// 408 | COUNTER++; 409 | } 410 | else 411 | { 412 | COUNTER++; 413 | } 414 | } 415 | } 416 | READ.close(); 417 | 418 | ofstream OVER_WRITE; 419 | OVER_WRITE.open("./Feedback Form/Feedback Form.txt"); 420 | { 421 | for (int i = 0; i < LINE_COUNT; i++) 422 | { 423 | if (i != QUESTION - 1) //... writing all the questions except the one we want to remove...// 424 | { 425 | OVER_WRITE << FEEDBACK_FORM[i] << endl; 426 | } 427 | } 428 | } 429 | OVER_WRITE.close(); 430 | 431 | cout << " __________________________________________________\n"; 432 | cout << " | QUESTION REMOVED SUCCESSFULLY... |\n"; 433 | cout << " |__________________________________________________|\n"; 434 | cout << "\n"; 435 | delete[]FEEDBACK_FORM; 436 | } 437 | else 438 | { 439 | throw QUESTION; 440 | } 441 | } 442 | catch (int QUESTION) 443 | { 444 | cout << '\a'; 445 | cin.clear(); 446 | cin.ignore(256, '\n'); 447 | QUESTION = 0; 448 | CLEAR_SCREEN(); 449 | cout << flush; 450 | for (int i = 3; i > 0; i--) 451 | { 452 | cout << "\n\n\n"; 453 | cout << " __________________________________________________\n"; 454 | cout << " | Wrong Choice, TRY AGAIN in " << i << " seconds...!!!\n"; 455 | cout << " |__________________________________________________\n"; 456 | Sleep(1000); 457 | CLEAR_SCREEN(); 458 | } 459 | REMOVE_QUESTION(); 460 | } 461 | } 462 | /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 463 | 464 | 465 | ///////////////////////////////////////// 1.3 SEARCH IN FEEDBACK FORM //////////////////////////////////////////////////// 466 | bool ADMIN::SEARCH_IN_FEEDBACK_FORM() 467 | { 468 | CLEAR_SCREEN(); 469 | TITLE(); 470 | cout << " __________________________________________________\n"; 471 | cout << " | SEARCH IN FEEDBACK FORM |\n"; 472 | cout << " |__________________________________________________|\n"; 473 | cout << "\n"; 474 | 475 | string QUERY; 476 | cout << " Enter your Search Query: "; 477 | cin.ignore(); 478 | getline(cin, QUERY); 479 | 480 | string* FEEDBACK_FORM; 481 | int LINE_COUNT = 0; 482 | int COUNTER = 0; 483 | 484 | fstream READ; 485 | string READ_LINE; 486 | READ.open("./Feedback Form/Feedback Form.txt", ios::in); 487 | { 488 | while (getline(READ, READ_LINE)) 489 | { 490 | LINE_COUNT++; 491 | } 492 | } 493 | READ.close(); 494 | /////////////////////////////////////////////////////////////////////////////// 495 | FEEDBACK_FORM = new string[LINE_COUNT];//...Dynamic String Array that has element number = lines in feedback form...// 496 | //... [each line has one question, hence each index will carry one question]..// 497 | 498 | READ.open("./Feedback Form/Feedback Form.txt", ios::in); 499 | { 500 | while (getline(READ, READ_LINE)) 501 | { 502 | FEEDBACK_FORM[COUNTER] = READ_LINE; 503 | COUNTER++; 504 | } 505 | } 506 | READ.close(); 507 | 508 | for (int i = 0; i < LINE_COUNT; i++) 509 | { 510 | if (FEEDBACK_FORM[i].find(QUERY) != string::npos) //...searching until end of file for the query...// 511 | { 512 | return TRUE; 513 | } 514 | } 515 | return FALSE; 516 | } 517 | /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 518 | 519 | 520 | ////////////////////////////////////////////// 2.ADMIN MANAGE STUDENTS MENU ///////////////////////////////////////////////// 521 | int ADMIN::ADMIN_MANAGE_STUDENTS_MENU_FUNCTION(int choice) 522 | { 523 | CLEAR_SCREEN(); 524 | TITLE(); 525 | 526 | cout << " >> Please choose one of the following options:\n\n"; 527 | 528 | cout << " ____________________________________________" << endl; 529 | cout << " |1. Check Total Number of Students |" << endl; 530 | cout << " |2. Search A Student [NEPTUN CODE] |" << endl; 531 | cout << " |3. Remove A Student [NEPTUN CODE] |" << endl; 532 | cout << " |4. Add A New Student [NEPTUN CODE] |" << endl; 533 | cout << " |5. Return to Main Menu |" << endl; 534 | cout << " |6. Exit |" << endl; 535 | { 536 | cout << "\n Answer: "; 537 | 538 | ////////////////////////////////////////////////////////// 539 | try //.... Exception Handling incase of Wrong Input ...// 540 | { ////////////////////////////////////////////////////////// 541 | cin >> choice; 542 | if ((choice <= 6) && (choice >= 1)) 543 | { 544 | return choice; 545 | } 546 | else 547 | { 548 | throw choice; 549 | } 550 | } 551 | catch (int choice) 552 | { 553 | cout << '\a'; 554 | cin.clear(); 555 | cin.ignore(256, '\n'); 556 | choice = 0; 557 | CLEAR_SCREEN(); 558 | cout << flush; 559 | for (int i = 3; i > 0; i--) 560 | { 561 | cout << "\n\n\n"; 562 | cout << " __________________________________________________\n"; 563 | cout << " | Wrong Choice, TRY AGAIN in " << i << " seconds...!!!\n"; 564 | cout << " |__________________________________________________\n"; 565 | Sleep(1000); 566 | CLEAR_SCREEN(); 567 | } 568 | ADMIN_MANAGE_STUDENTS_MENU_FUNCTION(choice); 569 | } 570 | } 571 | } 572 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 573 | 574 | 575 | //////////////////////////////////////////// 2.1.CHECK TOTAL NUMBER OF STUDENTS /////////////////////////////////////////////// 576 | void ADMIN::TOTAL_STUDENTS() 577 | { 578 | CLEAR_SCREEN(); 579 | TITLE(); 580 | cout << " ________________________________________________\n"; 581 | cout << " | TOTAL STUDENTS |\n"; 582 | cout << " |________________________________________________|\n"; 583 | cout << "\n"; 584 | 585 | int TOTAL_FILES = 0; 586 | string FILE_PATH = "./Students/"; ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 587 | for (auto& p : filesystem::directory_iterator(FILE_PATH)) // This Loop was inspired by Stack Overflow Discussion on File Counting Methods, It makes use of FILESYSTEM library.....// 588 | { // https://stackoverflow.com/questions/41304891/how-to-count-the-number-of-files-in-a-directory-using-standard/41305019 // 589 | TOTAL_FILES++; ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 590 | 591 | } 592 | cout << "\n >> Total Number of Students: " << TOTAL_FILES << " <<" << endl << endl << endl; 593 | } 594 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 595 | 596 | 597 | ////////////////////////////////////// 2.2.SEARCH A STUDENT [NEPTUN CODE] ///////////////////////////////////// 598 | void ADMIN::SEARCH_STUDENT() 599 | { 600 | CLEAR_SCREEN(); 601 | TITLE(); 602 | cout << " __________________________________________________\n"; 603 | cout << " | SEARCH A STUDENT |\n"; 604 | cout << " |__________________________________________________|\n"; 605 | cout << "\n"; 606 | 607 | string NEPTUN; 608 | cout << " Enter NEPTUN CODE: "; 609 | cin >> NEPTUN; 610 | 611 | string FILE_PATH = "./Students/" + NEPTUN + ".txt"; 612 | 613 | if (!CHECK_EXISTING_FILE(FILE_PATH.c_str())) //... each student has it's own file, named as his/her NEPTUN code, if the students exists, it means his/her file MUST exist too.../// 614 | { 615 | cout << "\n\n\n"; 616 | cout << " __________________________________________________\n"; 617 | cout << " | No Student exists under this NEPTUN Code... \n"; 618 | cout << " |__________________________________________________\n"; 619 | } 620 | else 621 | { 622 | cout << "\n\n\n"; 623 | cout << " __________________________________________________\n"; 624 | cout << " | Student Exists In The Database... \n"; 625 | cout << " |__________________________________________________\n"; 626 | } 627 | } 628 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 629 | 630 | 631 | ////////////////////////////////////// 2.3.REMOVE A STUDENT [NEPTUN CODE] ///////////////////////////////////// 632 | void ADMIN::REMOVE_STUDENT() 633 | { 634 | CLEAR_SCREEN(); 635 | TITLE(); 636 | cout << " __________________________________________________\n"; 637 | cout << " | REMOVE A STUDENT |\n"; 638 | cout << " |__________________________________________________|\n"; 639 | cout << "\n"; 640 | cout << " >> Please be aware, removing a student will also remove his/her submitted feedbacks...!!!" << endl << endl; 641 | 642 | string NEPTUN; 643 | cout << " Enter NEPTUN CODE: "; 644 | cin >> NEPTUN; 645 | 646 | string FILE_PATH = "./Students/" + NEPTUN + ".txt"; 647 | 648 | if (!CHECK_EXISTING_FILE(FILE_PATH.c_str())) 649 | { 650 | cout << "\n\n\n"; 651 | cout << " __________________________________________________\n"; 652 | cout << " | No Student exists under this NEPTUN Code... \n"; 653 | cout << " |__________________________________________________\n"; 654 | } 655 | else 656 | { 657 | remove(FILE_PATH.c_str());//......................................................removing student 658 | string FILE_PATH = "./Feedback Form/Submitted Feedbacks/" + NEPTUN + ".txt";//...changing path to submitted feedback 659 | remove(FILE_PATH.c_str());//....................................................removing submitted feedback 660 | 661 | cout << "\n\n\n"; 662 | cout << " __________________________________________________\n"; 663 | cout << " | Student Deleted Successfully... \n"; 664 | cout << " |__________________________________________________\n"; 665 | } 666 | } 667 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 668 | 669 | 670 | ////////////////////////////////////// 2.4.ADD A NEW STUDENT [NEPTUN CODE] ///////////////////////////////////// 671 | void ADMIN::ADD_STUDENT() 672 | { 673 | CLEAR_SCREEN(); 674 | TITLE(); 675 | cout << " __________________________________________________\n"; 676 | cout << " | ADD A STUDENT |\n"; 677 | cout << " |__________________________________________________|\n"; 678 | cout << "\n"; 679 | 680 | string NEPTUN; 681 | cout << " Enter NEPTUN CODE: "; 682 | cin >> NEPTUN; 683 | 684 | 685 | string FILE_PATH = "./Students/" + NEPTUN + ".txt"; 686 | 687 | if (CHECK_EXISTING_FILE(FILE_PATH.c_str())) 688 | { 689 | cout << "\n\n\n"; 690 | cout << " __________________________________________________\n"; 691 | cout << " | Student already exists... \n"; 692 | cout << " |__________________________________________________\n"; 693 | } 694 | else 695 | { 696 | string PASSWORD; 697 | cout << " Set A New PASSWORD: "; //... setting a temporary password for the new student...// 698 | cin >> PASSWORD; 699 | 700 | fstream ADD; 701 | ADD.open(FILE_PATH.c_str(), ios::app); //...made a file named as Student's NPETUN, and added the password...// 702 | { 703 | ADD << PASSWORD; 704 | } 705 | ADD.close(); 706 | 707 | ENCRYPT(FILE_PATH.c_str()); //...encrypting the password...// 708 | cout << "\n\n\n"; 709 | cout << " __________________________________________________\n"; 710 | cout << " | Student Added Successfully... \n"; 711 | cout << " |__________________________________________________\n"; 712 | } 713 | } 714 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 715 | 716 | 717 | //////////////////////////////////////////// 3.ADMIN MANAGE SUBMITTED FEEDBACKS MENU /////////////////////////////////////////////// 718 | int ADMIN::ADMIN_MANAGE_SUBMITTED_FEEDBACKS_MENU_FUNCTION(int choice) 719 | { 720 | CLEAR_SCREEN(); 721 | TITLE(); 722 | 723 | cout << " >> Please choose one of the following options:\n\n"; 724 | 725 | cout << " _________________________________________________" << endl; 726 | cout << " |1. Check Total Number of Submitted Feedbacks |" << endl; 727 | cout << " |2. Print A Student's Feedback [NEPTUN CODE] |" << endl; 728 | cout << " |3. Remove A Student's Feedback [NEPTUN CODE] |" << endl; 729 | cout << " |4. Return to Main Menu |" << endl; 730 | cout << " |5. Exit |" << endl; 731 | { 732 | cout << "\n Answer: "; 733 | 734 | ////////////////////////////////////////////////////////// 735 | try //.... Exception Handling incase of Wrong Input ...// 736 | { ////////////////////////////////////////////////////////// 737 | cin >> choice; 738 | if ((choice <= 5) && (choice >= 1)) 739 | { 740 | return choice; 741 | } 742 | else 743 | { 744 | throw choice; 745 | } 746 | } 747 | catch (int choice) 748 | { 749 | cout << '\a'; 750 | cin.clear(); 751 | cin.ignore(256, '\n'); 752 | choice = 0; 753 | CLEAR_SCREEN(); 754 | cout << flush; 755 | for (int i = 3; i > 0; i--) 756 | { 757 | cout << "\n\n\n"; 758 | cout << " __________________________________________________\n"; 759 | cout << " | Wrong Choice, TRY AGAIN in " << i << " seconds...!!!\n"; 760 | cout << " |__________________________________________________\n"; 761 | Sleep(1000); 762 | CLEAR_SCREEN(); 763 | } 764 | ADMIN_MANAGE_SUBMITTED_FEEDBACKS_MENU_FUNCTION(choice); 765 | } 766 | } 767 | } 768 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 769 | 770 | 771 | //////////////////////////////////// 3.1.CHECK TOTAL NUMBER OF SUBMITTED FEEDBACKS /////////////////////////////////////// 772 | void ADMIN::TOTAL_SUBMITTED_FEEDBACKS() 773 | { 774 | CLEAR_SCREEN(); 775 | TITLE(); 776 | cout << " ________________________________________________\n"; 777 | cout << " | TOTAL SUBMITTED FEEDBACK FORMS |\n"; 778 | cout << " |________________________________________________|\n"; 779 | cout << "\n"; 780 | 781 | int TOTAL_FILES = 0; 782 | string FILE_PATH = "./Feedback Form/Submitted Feedbacks/"; ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 783 | for (auto& p : filesystem::directory_iterator(FILE_PATH)) // This Loop was inspired by Stack Overflow Discussion on File Counting Methods, It makes use of FILESYSTEM library.....// 784 | { // https://stackoverflow.com/questions/41304891/how-to-count-the-number-of-files-in-a-directory-using-standard/41305019 // 785 | TOTAL_FILES++; ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 786 | 787 | } 788 | cout << "\n >> Total Number of Submitted Feedback Files: " << TOTAL_FILES << " <<" << endl << endl << endl; 789 | } 790 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 791 | 792 | 793 | ////////////////////////////////////// 3.2.PRINT A STUDENT'S FEEDBACK [NEPTUN CODE] ///////////////////////////////////// 794 | bool ADMIN::PRINT_SUBMITTED_FEEDBACK_FORM() 795 | { 796 | CLEAR_SCREEN(); 797 | TITLE(); 798 | cout << " ___________________________________________\n"; 799 | cout << " | SUBMITTED FEEDBACK FORM |\n"; 800 | cout << " |___________________________________________|\n"; 801 | cout << "\n"; 802 | 803 | string NEPTUN; 804 | cout << " Enter NEPTUN CODE: "; 805 | cin >> NEPTUN; 806 | 807 | string FILE_PATH = "./Feedback Form/Submitted Feedbacks/" + NEPTUN + ".txt"; 808 | 809 | if (!CHECK_EXISTING_FILE(FILE_PATH.c_str())) 810 | { 811 | cout << "\n\n\n"; 812 | cout << " __________________________________________________\n"; 813 | cout << " | No Feedback Submitted by this student yet... \n"; 814 | cout << " |__________________________________________________\n"; 815 | return FALSE; 816 | } 817 | else 818 | { 819 | string SUBMITTED_FEEDBACK_FORM; 820 | fstream READ; 821 | READ.open(FILE_PATH.c_str(), ios::in); 822 | { 823 | while (getline(READ, SUBMITTED_FEEDBACK_FORM)) 824 | { 825 | cout << SUBMITTED_FEEDBACK_FORM << endl; 826 | } 827 | } 828 | READ.close(); 829 | return TRUE; 830 | } 831 | 832 | } 833 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 834 | 835 | 836 | ////////////////////////////////////// 3.3.REMOVE A STUDENT'S FEEDBACK [NEPTUN CODE] ///////////////////////////////////// 837 | void ADMIN::REMOVE_SUBMITTED_FEEDBACK() 838 | { 839 | CLEAR_SCREEN(); 840 | TITLE(); 841 | cout << " __________________________________________________\n"; 842 | cout << " | REMOVE SUBMITTED FEEDBACK FORM |\n"; 843 | cout << " |__________________________________________________|\n"; 844 | cout << "\n"; 845 | 846 | string NEPTUN; 847 | cout << " Enter NEPTUN CODE: "; 848 | cin >> NEPTUN; 849 | 850 | string FILE_PATH = "./Feedback Form/Submitted Feedbacks/" + NEPTUN + ".txt"; //... default path for submitted feedbacks...// 851 | 852 | if (!CHECK_EXISTING_FILE(FILE_PATH.c_str())) 853 | { 854 | cout << "\n\n\n"; 855 | cout << " __________________________________________________\n"; 856 | cout << " | No Feedback Submitted by this student yet... \n"; 857 | cout << " |__________________________________________________\n"; 858 | } 859 | else 860 | { 861 | remove(FILE_PATH.c_str()); 862 | 863 | cout << "\n\n\n"; 864 | cout << " __________________________________________________\n"; 865 | cout << " | Submitted Feedback File Deleted Successfully... \n"; 866 | cout << " |__________________________________________________\n"; 867 | } 868 | } 869 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 870 | 871 | 872 | /////////////////////////////////////// 4. CHANGE YOUR PASSWORD /////////////////////////////////////////// 873 | void ADMIN::CHANGE_PASSWORD() 874 | { 875 | CLEAR_SCREEN(); 876 | TITLE(); 877 | cout << " ________________________________________________\n"; 878 | cout << " | CHANGE YOUR PASSWORD |\n"; 879 | cout << " |________________________________________________|\n"; 880 | cout << "\n"; 881 | 882 | string NEW_PASSWORD; 883 | cout << " >> Enter your NEW PASSWORD: "; 884 | cin >> NEW_PASSWORD; 885 | 886 | string FILE_PATH = "./Admin/ADMIN_PASSWORD.txt"; 887 | ofstream OVER_WRITE; 888 | OVER_WRITE.open(FILE_PATH.c_str()); // opening in default [over-write] mode 889 | { 890 | OVER_WRITE << NEW_PASSWORD; // over writing the old password 891 | } 892 | OVER_WRITE.close(); 893 | ENCRYPT(FILE_PATH.c_str()); // encryopting the new password 894 | 895 | cout << " ________________________________________________\n"; 896 | cout << " | PASSWORD CHANGED SUCCESSFULLY... |\n"; 897 | cout << " |________________________________________________|\n"; 898 | cout << "\n"; 899 | 900 | 901 | } 902 | /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 903 | 904 | 905 | //////////////////////////////////////// CHECK EXISTING FILE /////////////////////////////////////////// 906 | bool ADMIN::CHECK_EXISTING_FILE(const string& FILE_NAME) 907 | { 908 | fstream READ; 909 | READ.open(FILE_NAME.c_str(), ios::in); 910 | { 911 | if (READ.is_open()) // file exists and can be opened... 912 | { 913 | READ.close(); 914 | return TRUE; // file found... 915 | } 916 | return false; // file not found... 917 | } 918 | } 919 | ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 920 | 921 | //////////////////////////////////////// ENCRYPT /////////////////////////////////////////// 922 | void ADMIN::ENCRYPT(const string& FILE_NAME) 923 | { 924 | string DATA; 925 | fstream READ; 926 | READ.open(FILE_NAME.c_str(), ios::in); 927 | { 928 | getline(READ, DATA); 929 | for (unsigned int x = 0; x < DATA.length(); x++) 930 | { 931 | DATA[x] += 3; // using simple ceasar cipher... 932 | //add a number to each character 933 | //and garble the whole string character by character 934 | } 935 | } 936 | READ.close(); 937 | 938 | ofstream OVERWRITE; 939 | OVERWRITE.open(FILE_NAME.c_str()); 940 | { 941 | OVERWRITE << DATA; // over-write the old data with new encrypted data... 942 | } 943 | OVERWRITE.close(); 944 | } 945 | 946 | //////////////////////////////////////// DECRYPT /////////////////////////////////////////// 947 | void ADMIN::DECRYPT(const string& FILE_NAME) 948 | { 949 | string DATA; 950 | fstream READ; 951 | READ.open(FILE_NAME.c_str(), ios::in); 952 | { 953 | getline(READ, DATA); 954 | for (unsigned int x = 0; x < DATA.length(); x++) 955 | { 956 | DATA[x] -= 3;// using simple ceasar cipher... 957 | //add a number to each character 958 | //and garble the whole string character by character 959 | } 960 | } 961 | READ.close(); 962 | 963 | ofstream OVERWRITE; 964 | OVERWRITE.open(FILE_NAME.c_str()); 965 | { 966 | OVERWRITE << DATA;// over-write the old data with new encrypted data... 967 | } 968 | OVERWRITE.close(); 969 | } -------------------------------------------------------------------------------- /source files/Project_Headers.h: -------------------------------------------------------------------------------- 1 | #ifndef PROJECT_HEADERS_H 2 | #define PROJECT_HEADERS_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | //#include 12 | //#include 13 | //#include 14 | 15 | using namespace std; 16 | 17 | 18 | ///////////////////////////////////// CLear Console Screen ////////////////////////////////// 19 | void CLEAR_SCREEN() 20 | { 21 | system("cls"); 22 | } 23 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 24 | 25 | ///////////////////////////////////// Exit / Terminte ////////////////////////////////// 26 | void EXIT() 27 | { 28 | cout << "\n\n\n"; 29 | cout << " __________________________________________________\n"; 30 | cout << " | Terminating the Program in 1 second...!!! |\n"; 31 | cout << " |__________________________________________________|\n"; 32 | Sleep(1000); 33 | } 34 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 35 | 36 | //////////////////////////////////////////////// TITLE SCREEN /////////////////////////////////////////////// 37 | void TITLE() 38 | { 39 | cout << "\n\n"; 40 | cout << " ________________________________________________________________\n"; 41 | cout << " | COURSE FEEDBACK MANAGEMENT SYSTEM |\n"; 42 | cout << " |________________________________________________________________|\n"; 43 | cout << "\n\n\n"; 44 | } 45 | /////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 46 | 47 | ////////////////////////////////////////////// MAIN MENU 0R EXIT ///////////////////////////////////////////// 48 | int MAIN_MENU_OR_EXIT(int choice) 49 | { 50 | cout << "\n\n"; 51 | cout << " >> Please choose one of the following options:\n\n"; 52 | cout << " ____________________________________________" << endl; 53 | cout << " |1. Return to Main Menu |" << endl; 54 | cout << " |2. Exit |" << endl; 55 | { 56 | cout << "\n Answer: "; 57 | 58 | ////////////////////////////////////////////////////////// 59 | try //.... Exception Handling incase of Wrong Input ...// 60 | { ////////////////////////////////////////////////////////// 61 | cin >> choice; 62 | if ((choice == 2) || (choice == 1)) 63 | { 64 | return choice; 65 | } 66 | else 67 | { 68 | throw choice; 69 | } 70 | } 71 | catch (int choice) 72 | { 73 | cout << '\a'; 74 | cin.clear(); 75 | cin.ignore(256, '\n'); 76 | choice = 0; 77 | CLEAR_SCREEN(); 78 | cout << flush; 79 | for (int i = 3; i > 0; i--) 80 | { 81 | cout << "\n\n\n"; 82 | cout << " __________________________________________________\n"; 83 | cout << " | Wrong Choice, TRY AGAIN in " << i << " seconds...!!!\n"; 84 | cout << " |__________________________________________________\n"; 85 | Sleep(1000); 86 | CLEAR_SCREEN(); 87 | } 88 | TITLE(); 89 | MAIN_MENU_OR_EXIT(choice); 90 | } 91 | } 92 | } 93 | /////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 94 | 95 | 96 | 97 | 98 | 99 | 100 | class ADMIN 101 | { 102 | string USERNAME; 103 | string PASSWORD; 104 | public: 105 | //string USERNAME; 106 | string LOWER_USERNAME; 107 | //string PASSWORD; 108 | bool LOGIN_SUCCESSFUL; 109 | 110 | ADMIN() //// Default Constructor //// 111 | { 112 | LOGIN_SUCCESSFUL = false; 113 | } 114 | 115 | void SET_USERNAME(string SET_THIS_USERNAME) //// Setter for USERNAME //// 116 | { 117 | USERNAME = SET_THIS_USERNAME; 118 | } 119 | string GET_USERNAME() //// Getter for USERNAME //// 120 | { 121 | return USERNAME; 122 | } 123 | 124 | void SET_PASSWORD(string SET_THIS_PASSWORD) //// Setter for PASSWORD //// 125 | { 126 | PASSWORD = SET_THIS_PASSWORD; 127 | } 128 | string GET_PASSWORD() //// Getter for PASSWORD //// 129 | { 130 | return PASSWORD; 131 | } 132 | 133 | ////////////////////////////////////////////////// LOGIN FUNCTION ///////////////////////////////////////////////////// 134 | bool LOGIN_FUNCTION(bool ITS_ADMIN) 135 | { 136 | cout << "Enter your LOGIN: " << flush; 137 | cin >> USERNAME; 138 | 139 | //------------function to convert string into lowercase--------------- 140 | LOWER_USERNAME = USERNAME; 141 | transform(LOWER_USERNAME.begin(), LOWER_USERNAME.end(), LOWER_USERNAME.begin(), ::tolower); 142 | ////////////////////////////////////////////////////////////////////// 143 | if (LOWER_USERNAME == "admin") 144 | { 145 | ITS_ADMIN = TRUE; 146 | return ITS_ADMIN; 147 | } 148 | else 149 | { 150 | ITS_ADMIN = FALSE; 151 | return ITS_ADMIN; 152 | } 153 | } 154 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 155 | 156 | 157 | /////////////////////////////////////// LOGIN VALIDATION FUNCTION ///////////////////////////////////////////////////// 158 | virtual bool LOGIN_VALIDATION_FUNCTION() 159 | { 160 | cout << "Enter your PASSWORD: " << flush; 161 | cin >> PASSWORD; 162 | string ADMIN_FILE_PATH = "./Admin/ADMIN_LOGIN.txt"; 163 | string CHECK = GET_LOGIN_DATA(ADMIN_FILE_PATH.c_str()); 164 | /////////////////////////////////////////////////////////// 165 | try //... Exception Handling incase of Unsuccessful Login ...// 166 | { ////////////////////////////////////////////////////////// 167 | if (CHECK == USERNAME) 168 | { 169 | ADMIN_FILE_PATH = "./Admin/ADMIN_PASSWORD.txt"; 170 | CHECK = GET_LOGIN_DATA(ADMIN_FILE_PATH.c_str()); 171 | if (CHECK == PASSWORD) 172 | { 173 | cout << "LOGIN SUCCESSFUL...!" << endl; 174 | LOGIN_SUCCESSFUL = true; 175 | return TRUE; 176 | } 177 | else 178 | { 179 | throw LOGIN_SUCCESSFUL; 180 | } 181 | } 182 | else 183 | { 184 | throw LOGIN_SUCCESSFUL; 185 | } 186 | } 187 | catch (bool LOGIN_SUCCESSFUL) 188 | { 189 | UNREFERENCED_PARAMETER(LOGIN_SUCCESSFUL); 190 | CLEAR_SCREEN(); 191 | cout << flush; 192 | TITLE(); 193 | cout << "login Failed, Try Again..." << endl << endl; 194 | bool ITS_ADMIN = FALSE; 195 | return FALSE; 196 | } 197 | } 198 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 199 | 200 | 201 | //////////////////////////////////////// GET USERNAME & PASSWORD FUNCTION /////////////////////////////////////////// 202 | string GET_LOGIN_DATA(const string& FILE_NAME) 203 | { 204 | string LINE; 205 | fstream READ; 206 | READ.open(FILE_NAME.c_str(), ios::in); 207 | { 208 | if (READ.is_open()) 209 | { 210 | getline(READ, LINE); 211 | } 212 | } 213 | READ.close(); 214 | return LINE; 215 | } 216 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 217 | 218 | 219 | ////////////////////////////////////////////////// ADMIN MAIN MENU ///////////////////////////////////////////////////// 220 | int ADMIN_MAIN_MENU_FUNCTION(int choice) 221 | { 222 | CLEAR_SCREEN(); 223 | TITLE(); 224 | cout << " You're now logged in as an ADMINISTRATOR...." << endl << endl << endl; 225 | 226 | cout << " >> Please choose one of the following options:\n\n"; 227 | 228 | cout << " ____________________________________________" << endl; 229 | cout << " |1. Manage Feedback Form |" << endl; 230 | cout << " |2. Manage Students |" << endl; 231 | cout << " |3. Manage Submitted Feedbacks |" << endl; 232 | cout << " |4. Change Your Password |" << endl; 233 | cout << " |5. Log-Out |" << endl; 234 | cout << " |6. Exit |" << endl; 235 | { 236 | cout << "\n Answer: "; 237 | 238 | ////////////////////////////////////////////////////////// 239 | try //.... Exception Handling incase of Wrong Input ...// 240 | { ////////////////////////////////////////////////////////// 241 | cin >> choice; 242 | if ((choice <= 6) && (choice >= 1)) 243 | { 244 | return choice; 245 | } 246 | else 247 | { 248 | throw choice; 249 | } 250 | } 251 | catch (int choice) 252 | { 253 | cout << '\a'; 254 | cin.clear(); 255 | cin.ignore(256, '\n'); 256 | choice = 0; 257 | CLEAR_SCREEN(); 258 | cout << flush; 259 | for (int i = 3; i > 0; i--) 260 | { 261 | cout << "\n\n\n"; 262 | cout << " __________________________________________________\n"; 263 | cout << " | Wrong Choice, TRY AGAIN in " << i << " seconds...!!!\n"; 264 | cout << " |__________________________________________________\n"; 265 | Sleep(1000); 266 | CLEAR_SCREEN(); 267 | } 268 | ADMIN_MAIN_MENU_FUNCTION(choice); 269 | } 270 | } 271 | } 272 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 273 | 274 | 275 | ////////////////////////////////////////////// 1.ADMIN MANAGE FEEDBACK FORM MENU ///////////////////////////////////////////////// 276 | int ADMIN_MANAGE_FEEDBACK_FORM_MENU_FUNCTION(int choice) 277 | { 278 | CLEAR_SCREEN(); 279 | TITLE(); 280 | 281 | cout << " >> Please choose one of the following options:\n\n"; 282 | 283 | cout << " ____________________________________________" << endl; 284 | cout << " |1. Print Feedback Form |" << endl; 285 | cout << " |2. Edit Feedback Form |" << endl; 286 | cout << " |3. Search Feedback Form |" << endl; 287 | cout << " |4. Return to Main Menu |" << endl; 288 | cout << " |5. Exit |" << endl; 289 | { 290 | cout << "\n Answer: "; 291 | 292 | ////////////////////////////////////////////////////////// 293 | try //.... Exception Handling incase of Wrong Input ...// 294 | { ////////////////////////////////////////////////////////// 295 | cin >> choice; 296 | if ((choice <= 5) && (choice >= 1)) 297 | { 298 | return choice; 299 | } 300 | else 301 | { 302 | throw choice; 303 | } 304 | } 305 | catch (int choice) 306 | { 307 | cout << '\a'; 308 | cin.clear(); 309 | cin.ignore(256, '\n'); 310 | choice = 0; 311 | CLEAR_SCREEN(); 312 | cout << flush; 313 | for (int i = 3; i > 0; i--) 314 | { 315 | cout << "\n\n\n"; 316 | cout << " __________________________________________________\n"; 317 | cout << " | Wrong Choice, TRY AGAIN in " << i << " seconds...!!!\n"; 318 | cout << " |__________________________________________________\n"; 319 | Sleep(1000); 320 | CLEAR_SCREEN(); 321 | } 322 | ADMIN_MANAGE_FEEDBACK_FORM_MENU_FUNCTION(choice); 323 | } 324 | } 325 | } 326 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 327 | 328 | 329 | ///////////////////////////////////////////// 1.1.PRINT THE FEEDBACK FORM //////////////////////////////////////////////// 330 | void PRINT_FEEDBACK_FORM() 331 | { 332 | cout << " _________________________________\n"; 333 | cout << " | FEEDBACK FORM |\n"; 334 | cout << " |_________________________________|\n"; 335 | cout << "\n"; 336 | string *FEEDBACK_FORM; 337 | int LINE_COUNT = 0; 338 | int COUNTER = 0; 339 | 340 | fstream READ; 341 | string READ_LINE; 342 | READ.open("./Feedback Form/Feedback Form.txt", ios::in); 343 | { 344 | while (getline(READ, READ_LINE)) 345 | { 346 | LINE_COUNT++; 347 | } 348 | } 349 | READ.close(); 350 | /////////////////////////////////////////////////////////////////////////////// 351 | FEEDBACK_FORM = new string [LINE_COUNT];//...Dynamic String Array that has element number = lines in feedback form...// 352 | //... [each line has one question, hence each index will carry one question]..// 353 | 354 | READ.open("./Feedback Form/Feedback Form.txt", ios::in); 355 | { 356 | while (getline(READ, READ_LINE)) 357 | { 358 | FEEDBACK_FORM[COUNTER] = READ_LINE; 359 | COUNTER++; 360 | } 361 | } 362 | READ.close(); 363 | 364 | for(int i=0; i> Please choose one of the following options:\n\n"; 383 | 384 | cout << " ____________________________________________" << endl; 385 | cout << " |1. Add A New Question |" << endl; 386 | cout << " |2. Remove A Question |" << endl; 387 | cout << " |3. Return to Main Menu |" << endl; 388 | cout << " |4. Exit |" << endl; 389 | { 390 | cout << "\n Answer: "; 391 | 392 | ////////////////////////////////////////////////////////// 393 | try //.... Exception Handling incase of Wrong Input ...// 394 | { ////////////////////////////////////////////////////////// 395 | cin >> choice; 396 | if ((choice <= 4) && (choice >= 1)) 397 | { 398 | return choice; 399 | } 400 | else 401 | { 402 | throw choice; 403 | } 404 | } 405 | catch (int choice) 406 | { 407 | cout << '\a'; 408 | cin.clear(); 409 | cin.ignore(256, '\n'); 410 | choice = 0; 411 | CLEAR_SCREEN(); 412 | cout << flush; 413 | for (int i = 3; i > 0; i--) 414 | { 415 | cout << "\n\n\n"; 416 | cout << " __________________________________________________\n"; 417 | cout << " | Wrong Choice, TRY AGAIN in " << i << " seconds...!!!\n"; 418 | cout << " |__________________________________________________\n"; 419 | Sleep(1000); 420 | CLEAR_SCREEN(); 421 | } 422 | ADMIN_EDIT_FEEDBACK_FORM_MENU_FUNCTION(choice); 423 | } 424 | } 425 | } 426 | /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 427 | 428 | 429 | ///////////////////////////////////////// 1.2.1 ADD A NEW QUESTION //////////////////////////////////////////////////// 430 | void ADD_QUESTION() 431 | { 432 | CLEAR_SCREEN(); 433 | TITLE(); 434 | cout << " __________________________________________________\n"; 435 | cout << " | ADD A NEW QUESTION |\n"; 436 | cout << " |__________________________________________________|\n"; 437 | cout << "\n"; 438 | 439 | string QUESTION; 440 | cout << " Enter The NEW QUESTION: "; 441 | cin.ignore(); 442 | getline(cin, QUESTION); 443 | 444 | fstream READ; 445 | string READ_LINE; 446 | int LINE_COUNT = 0; 447 | READ.open("./Feedback Form/Feedback Form.txt", ios::in); 448 | { 449 | while (getline(READ, READ_LINE)) 450 | { 451 | LINE_COUNT++; 452 | } 453 | } 454 | READ.close(); 455 | 456 | QUESTION = to_string(LINE_COUNT+1) + ") " + QUESTION; 457 | 458 | READ.open("./Feedback Form/Feedback Form.txt", ios::app); 459 | { 460 | READ<> QUESTION; 501 | if ((QUESTION <= LINE_COUNT) && (QUESTION >= 1)) 502 | { 503 | string *FEEDBACK_FORM; 504 | int COUNTER = 0; 505 | /////////////////////////////////////////////////////////////////////////////// 506 | FEEDBACK_FORM = new string [LINE_COUNT];//...Dynamic String Array that has element number = lines in feedback form...// 507 | //... [each line has one question, hence each index will carry one question]..// 508 | READ.open("./Feedback Form/Feedback Form.txt", ios::in); 509 | { 510 | while (getline(READ, READ_LINE)) 511 | { 512 | if((COUNTER+1) != QUESTION) 513 | { 514 | FEEDBACK_FORM[COUNTER] = READ_LINE; 515 | COUNTER++; 516 | } 517 | else 518 | { 519 | COUNTER++; 520 | } 521 | } 522 | } 523 | READ.close(); 524 | 525 | ofstream OVER_WRITE; 526 | OVER_WRITE.open("./Feedback Form/Feedback Form.txt"); 527 | { 528 | for(int i=0; i 0; i--) 558 | { 559 | cout << "\n\n\n"; 560 | cout << " __________________________________________________\n"; 561 | cout << " | Wrong Choice, TRY AGAIN in " << i << " seconds...!!!\n"; 562 | cout << " |__________________________________________________\n"; 563 | Sleep(1000); 564 | CLEAR_SCREEN(); 565 | } 566 | REMOVE_QUESTION(); 567 | } 568 | } 569 | /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 570 | 571 | 572 | ///////////////////////////////////////// 1.3 SEARCH IN FEEDBACK FORM //////////////////////////////////////////////////// 573 | bool SEARCH_IN_FEEDBACK_FORM() 574 | { 575 | CLEAR_SCREEN(); 576 | TITLE(); 577 | cout << " __________________________________________________\n"; 578 | cout << " | SEARCH IN FEEDBACK FORM |\n"; 579 | cout << " |__________________________________________________|\n"; 580 | cout << "\n"; 581 | 582 | string QUERY; 583 | cout << " Enter your Search Query: "; 584 | cin.ignore(); 585 | getline(cin, QUERY); 586 | 587 | string *FEEDBACK_FORM; 588 | int LINE_COUNT = 0; 589 | int COUNTER = 0; 590 | 591 | fstream READ; 592 | string READ_LINE; 593 | READ.open("./Feedback Form/Feedback Form.txt", ios::in); 594 | { 595 | while (getline(READ, READ_LINE)) 596 | { 597 | LINE_COUNT++; 598 | } 599 | } 600 | READ.close(); 601 | /////////////////////////////////////////////////////////////////////////////// 602 | FEEDBACK_FORM = new string [LINE_COUNT];//...Dynamic String Array that has element number = lines in feedback form...// 603 | //... [each line has one question, hence each index will carry one question]..// 604 | 605 | READ.open("./Feedback Form/Feedback Form.txt", ios::in); 606 | { 607 | while (getline(READ, READ_LINE)) 608 | { 609 | FEEDBACK_FORM[COUNTER] = READ_LINE; 610 | COUNTER++; 611 | } 612 | } 613 | READ.close(); 614 | 615 | for(int i=0; i> Please choose one of the following options:\n\n"; 634 | 635 | cout << " ____________________________________________" << endl; 636 | cout << " |1. Check Total Number of Students |" << endl; 637 | cout << " |2. Search A Student [NEPTUN CODE] |" << endl; 638 | cout << " |3. Remove A Student [NEPTUN CODE] |" << endl; 639 | cout << " |4. Add A New Student [NEPTUN CODE] |" << endl; 640 | cout << " |5. Return to Main Menu |" << endl; 641 | cout << " |6. Exit |" << endl; 642 | { 643 | cout << "\n Answer: "; 644 | 645 | ////////////////////////////////////////////////////////// 646 | try //.... Exception Handling incase of Wrong Input ...// 647 | { ////////////////////////////////////////////////////////// 648 | cin >> choice; 649 | if ((choice <= 6) && (choice >= 1)) 650 | { 651 | return choice; 652 | } 653 | else 654 | { 655 | throw choice; 656 | } 657 | } 658 | catch (int choice) 659 | { 660 | cout << '\a'; 661 | cin.clear(); 662 | cin.ignore(256, '\n'); 663 | choice = 0; 664 | CLEAR_SCREEN(); 665 | cout << flush; 666 | for (int i = 3; i > 0; i--) 667 | { 668 | cout << "\n\n\n"; 669 | cout << " __________________________________________________\n"; 670 | cout << " | Wrong Choice, TRY AGAIN in " << i << " seconds...!!!\n"; 671 | cout << " |__________________________________________________\n"; 672 | Sleep(1000); 673 | CLEAR_SCREEN(); 674 | } 675 | ADMIN_MANAGE_STUDENTS_MENU_FUNCTION(choice); 676 | } 677 | } 678 | } 679 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 680 | 681 | 682 | //////////////////////////////////////////// 2.1.CHECK TOTAL NUMBER OF STUDENTS /////////////////////////////////////////////// 683 | void TOTAL_STUDENTS() 684 | { 685 | CLEAR_SCREEN(); 686 | TITLE(); 687 | cout << " ________________________________________________\n"; 688 | cout << " | TOTAL STUDENTS |\n"; 689 | cout << " |________________________________________________|\n"; 690 | cout << "\n"; 691 | 692 | int TOTAL_FILES = 0; 693 | string FILE_PATH = "./Students/"; ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 694 | for (auto& p : filesystem::directory_iterator(FILE_PATH)) // This Loop was inspired by Stack Overflow Discussion on File Counting Methods, It makes use of FILESYSTEM library.....// 695 | { // https://stackoverflow.com/questions/41304891/how-to-count-the-number-of-files-in-a-directory-using-standard/41305019 // 696 | TOTAL_FILES++; ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 697 | 698 | } 699 | cout << "\n >> Total Number of Students: " << TOTAL_FILES<<" <<"<> NEPTUN; 717 | 718 | string FILE_PATH = "./Students/" + NEPTUN + ".txt"; 719 | 720 | if (!CHECK_EXISTING_FILE(FILE_PATH.c_str())) 721 | { 722 | cout << "\n\n\n"; 723 | cout << " __________________________________________________\n"; 724 | cout << " | No Student exists under this NEPTUN Code... \n"; 725 | cout << " |__________________________________________________\n"; 726 | } 727 | else 728 | { 729 | cout << "\n\n\n"; 730 | cout << " __________________________________________________\n"; 731 | cout << " | Student Exists In The Database... \n"; 732 | cout << " |__________________________________________________\n"; 733 | } 734 | } 735 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 736 | 737 | 738 | ////////////////////////////////////// 2.3.REMOVE A STUDENT [NEPTUN CODE] ///////////////////////////////////// 739 | void REMOVE_STUDENT() 740 | { 741 | CLEAR_SCREEN(); 742 | TITLE(); 743 | cout << " __________________________________________________\n"; 744 | cout << " | REMOVE A STUDENT |\n"; 745 | cout << " |__________________________________________________|\n"; 746 | cout << "\n"; 747 | cout<<" >> Please be aware, removing a student will also remove his/her submitted feedbacks...!!!"<> NEPTUN; 752 | 753 | string FILE_PATH = "./Students/" + NEPTUN + ".txt"; 754 | 755 | if (!CHECK_EXISTING_FILE(FILE_PATH.c_str())) 756 | { 757 | cout << "\n\n\n"; 758 | cout << " __________________________________________________\n"; 759 | cout << " | No Student exists under this NEPTUN Code... \n"; 760 | cout << " |__________________________________________________\n"; 761 | } 762 | else 763 | { 764 | remove(FILE_PATH.c_str());//......................................................removing student 765 | string FILE_PATH = "./Feedback Form/Submitted Feedbacks/" + NEPTUN + ".txt";//...changing path to submitted feedback 766 | remove(FILE_PATH.c_str());//....................................................removing submitted feedback 767 | 768 | cout << "\n\n\n"; 769 | cout << " __________________________________________________\n"; 770 | cout << " | Student Deleted Successfully... \n"; 771 | cout << " |__________________________________________________\n"; 772 | } 773 | } 774 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 775 | 776 | 777 | ////////////////////////////////////// 2.4.ADD A NEW STUDENT [NEPTUN CODE] ///////////////////////////////////// 778 | void ADD_STUDENT() 779 | { 780 | CLEAR_SCREEN(); 781 | TITLE(); 782 | cout << " __________________________________________________\n"; 783 | cout << " | ADD A STUDENT |\n"; 784 | cout << " |__________________________________________________|\n"; 785 | cout << "\n"; 786 | 787 | string NEPTUN; 788 | cout << " Enter NEPTUN CODE: "; 789 | cin >> NEPTUN; 790 | 791 | 792 | string FILE_PATH = "./Students/" + NEPTUN + ".txt"; 793 | 794 | if (CHECK_EXISTING_FILE(FILE_PATH.c_str())) 795 | { 796 | cout << "\n\n\n"; 797 | cout << " __________________________________________________\n"; 798 | cout << " | Student already exists... \n"; 799 | cout << " |__________________________________________________\n"; 800 | } 801 | else 802 | { 803 | string PASSWORD; 804 | cout << " Set A New PASSWORD: "; 805 | cin >> PASSWORD; 806 | 807 | fstream ADD; 808 | ADD.open(FILE_PATH.c_str(), ios::app); 809 | { 810 | ADD<> Please choose one of the following options:\n\n"; 830 | 831 | cout << " _________________________________________________" << endl; 832 | cout << " |1. Check Total Number of Submitted Feedbacks |" << endl; 833 | cout << " |2. Print A Student's Feedback [NEPTUN CODE] |" << endl; 834 | cout << " |3. Remove A Student's Feedback [NEPTUN CODE] |" << endl; 835 | cout << " |4. Return to Main Menu |" << endl; 836 | cout << " |5. Exit |" << endl; 837 | { 838 | cout << "\n Answer: "; 839 | 840 | ////////////////////////////////////////////////////////// 841 | try //.... Exception Handling incase of Wrong Input ...// 842 | { ////////////////////////////////////////////////////////// 843 | cin >> choice; 844 | if ((choice <= 5) && (choice >= 1)) 845 | { 846 | return choice; 847 | } 848 | else 849 | { 850 | throw choice; 851 | } 852 | } 853 | catch (int choice) 854 | { 855 | cout << '\a'; 856 | cin.clear(); 857 | cin.ignore(256, '\n'); 858 | choice = 0; 859 | CLEAR_SCREEN(); 860 | cout << flush; 861 | for (int i = 3; i > 0; i--) 862 | { 863 | cout << "\n\n\n"; 864 | cout << " __________________________________________________\n"; 865 | cout << " | Wrong Choice, TRY AGAIN in " << i << " seconds...!!!\n"; 866 | cout << " |__________________________________________________\n"; 867 | Sleep(1000); 868 | CLEAR_SCREEN(); 869 | } 870 | ADMIN_MANAGE_SUBMITTED_FEEDBACKS_MENU_FUNCTION(choice); 871 | } 872 | } 873 | } 874 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 875 | 876 | 877 | //////////////////////////////////// 3.1.CHECK TOTAL NUMBER OF SUBMITTED FEEDBACKS /////////////////////////////////////// 878 | void TOTAL_SUBMITTED_FEEDBACKS() 879 | { 880 | CLEAR_SCREEN(); 881 | TITLE(); 882 | cout << " ________________________________________________\n"; 883 | cout << " | TOTAL SUBMITTED FEEDBACK FORMS |\n"; 884 | cout << " |________________________________________________|\n"; 885 | cout << "\n"; 886 | 887 | int TOTAL_FILES = 0; 888 | string FILE_PATH = "./Feedback Form/Submitted Feedbacks/"; ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 889 | for (auto& p : filesystem::directory_iterator(FILE_PATH)) // This Loop was inspired by Stack Overflow Discussion on File Counting Methods, It makes use of FILESYSTEM library.....// 890 | { // https://stackoverflow.com/questions/41304891/how-to-count-the-number-of-files-in-a-directory-using-standard/41305019 // 891 | TOTAL_FILES++; ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 892 | 893 | } 894 | cout << "\n >> Total Number of Submitted Feedback Files: " << TOTAL_FILES<<" <<"<> NEPTUN; 912 | 913 | string FILE_PATH = "./Feedback Form/Submitted Feedbacks/" + NEPTUN + ".txt"; 914 | 915 | if (!CHECK_EXISTING_FILE(FILE_PATH.c_str())) 916 | { 917 | cout << "\n\n\n"; 918 | cout << " __________________________________________________\n"; 919 | cout << " | No Feedback Submitted by this student yet... \n"; 920 | cout << " |__________________________________________________\n"; 921 | return FALSE; 922 | } 923 | else 924 | { 925 | string SUBMITTED_FEEDBACK_FORM; 926 | fstream READ; 927 | READ.open(FILE_PATH.c_str(), ios::in); 928 | { 929 | while (getline(READ, SUBMITTED_FEEDBACK_FORM)) 930 | { 931 | cout << SUBMITTED_FEEDBACK_FORM << endl; 932 | } 933 | } 934 | READ.close(); 935 | return TRUE; 936 | } 937 | 938 | } 939 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 940 | 941 | 942 | ////////////////////////////////////// 3.3.REMOVE A STUDENT'S FEEDBACK [NEPTUN CODE] ///////////////////////////////////// 943 | void REMOVE_SUBMITTED_FEEDBACK() 944 | { 945 | CLEAR_SCREEN(); 946 | TITLE(); 947 | cout << " __________________________________________________\n"; 948 | cout << " | REMOVE SUBMITTED FEEDBACK FORM |\n"; 949 | cout << " |__________________________________________________|\n"; 950 | cout << "\n"; 951 | 952 | string NEPTUN; 953 | cout << " Enter NEPTUN CODE: "; 954 | cin >> NEPTUN; 955 | 956 | string FILE_PATH = "./Feedback Form/Submitted Feedbacks/" + NEPTUN + ".txt"; 957 | 958 | if (!CHECK_EXISTING_FILE(FILE_PATH.c_str())) 959 | { 960 | cout << "\n\n\n"; 961 | cout << " __________________________________________________\n"; 962 | cout << " | No Feedback Submitted by this student yet... \n"; 963 | cout << " |__________________________________________________\n"; 964 | } 965 | else 966 | { 967 | remove(FILE_PATH.c_str()); 968 | 969 | cout << "\n\n\n"; 970 | cout << " __________________________________________________\n"; 971 | cout << " | Submitted Feedback File Deleted Successfully... \n"; 972 | cout << " |__________________________________________________\n"; 973 | } 974 | } 975 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 976 | 977 | 978 | /////////////////////////////////////// 4. CHANGE YOUR PASSWORD /////////////////////////////////////////// 979 | virtual void CHANGE_PASSWORD() 980 | { 981 | CLEAR_SCREEN(); 982 | TITLE(); 983 | cout << " ________________________________________________\n"; 984 | cout << " | CHANGE YOUR PASSWORD |\n"; 985 | cout << " |________________________________________________|\n"; 986 | cout << "\n"; 987 | 988 | string NEW_PASSWORD; 989 | cout<<" >> Enter your NEW PASSWORD: "; 990 | cin >> NEW_PASSWORD; 991 | 992 | string FILE_PATH = "./Admin/ADMIN_PASSWORD.txt"; 993 | ofstream OVER_WRITE; 994 | OVER_WRITE.open(FILE_PATH.c_str()); 995 | { 996 | OVER_WRITE<> STUDENT_PASSWORD; 1046 | SET_PASSWORD(STUDENT_PASSWORD); 1047 | string STUDENT_FILE_PATH = "./Students/" + GET_USERNAME() + ".txt"; 1048 | 1049 | fstream CHECK_FILE_EXIST; 1050 | CHECK_FILE_EXIST.open(STUDENT_FILE_PATH.c_str(), ios::in); 1051 | 1052 | if (CHECK_FILE_EXIST.is_open()) 1053 | { 1054 | CHECK_FILE_EXIST.close(); 1055 | string CHECK = GET_LOGIN_DATA(STUDENT_FILE_PATH.c_str()); 1056 | /////////////////////////////////////////////////////////// 1057 | try //... Exception Handling incase of Unsuccessful Login ...// 1058 | { ////////////////////////////////////////////////////////// 1059 | if (CHECK == GET_PASSWORD()) 1060 | { 1061 | cout << "LOGIN SUCCESSFUL...!" << endl; 1062 | LOGIN_SUCCESSFUL = true; 1063 | return TRUE; 1064 | } 1065 | else 1066 | { 1067 | throw LOGIN_SUCCESSFUL; 1068 | } 1069 | } 1070 | catch (bool LOGIN_SUCCESSFUL) 1071 | { 1072 | UNREFERENCED_PARAMETER(LOGIN_SUCCESSFUL); 1073 | CLEAR_SCREEN(); 1074 | cout << flush; 1075 | TITLE(); 1076 | cout << "login Failed, Try Again..." << endl << endl; 1077 | bool ITS_STUDENT = FALSE; 1078 | return FALSE; 1079 | } 1080 | } 1081 | else 1082 | { 1083 | CLEAR_SCREEN(); 1084 | cout << flush; 1085 | TITLE(); 1086 | cout << "login Failed, Try Again..." << endl << endl; 1087 | bool ITS_STUDENT = FALSE; 1088 | return FALSE; 1089 | } 1090 | } 1091 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 1092 | 1093 | 1094 | ////////////////////////////////////////////////// STUDENT MAIN MENU ///////////////////////////////////////////////////// 1095 | int STUDENT_MAIN_MENU_FUNCTION(int choice) 1096 | { 1097 | CLEAR_SCREEN(); 1098 | TITLE(); 1099 | cout << " You're now logged in as a STUDENT...." << endl << endl << endl; 1100 | 1101 | cout << " >> Please choose one of the following options:\n\n"; 1102 | 1103 | cout << " ____________________________________________" << endl; 1104 | cout << " |1. View The Feedback Form |" << endl; 1105 | cout << " |2. Fill_Out The Feedback Form |" << endl; 1106 | cout << " |3. View Your Submitted Feedback |" << endl; 1107 | cout << " |4. Change Your Password |" << endl; 1108 | cout << " |5. Log_Out |" << endl; 1109 | cout << " |6. Exit |" << endl; 1110 | 1111 | 1112 | { 1113 | cout << "\n Answer: "; 1114 | 1115 | ////////////////////////////////////////////////////////// 1116 | try //.... Exception Handling incase of Wrong Input ...// 1117 | { ////////////////////////////////////////////////////////// 1118 | cin >> choice; 1119 | if ((choice <= 6) && (choice >= 1)) 1120 | { 1121 | return choice; 1122 | } 1123 | else 1124 | { 1125 | throw choice; 1126 | } 1127 | } 1128 | catch (int choice) 1129 | { 1130 | cout << '\a'; 1131 | cin.clear(); 1132 | cin.ignore(256, '\n'); 1133 | choice = 0; 1134 | CLEAR_SCREEN(); 1135 | cout << flush; 1136 | for (int i = 3; i > 0; i--) 1137 | { 1138 | cout << "\n\n\n"; 1139 | cout << " __________________________________________________\n"; 1140 | cout << " | Wrong Choice, TRY AGAIN in " << i << " seconds...!!!\n"; 1141 | cout << " |__________________________________________________\n"; 1142 | Sleep(1000); 1143 | CLEAR_SCREEN(); 1144 | } 1145 | STUDENT_MAIN_MENU_FUNCTION(choice); 1146 | } 1147 | } 1148 | } 1149 | /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 1150 | 1151 | 1152 | //////////////////////////////////////// 1. VIEW THE FEEDBACK FORM /////////////////////////////////////////// 1153 | //.................................................................................................................. 1154 | //... Using the Function from ADMIN CLASS IMPLEMENTATIONS [1.1.PRINT THE FEEDBACK FORM]............................. 1155 | //.................................................................................................................. 1156 | /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 1157 | 1158 | //////////////////////////////////////// 2. FILL_OUT THE FEEDBACK FORM /////////////////////////////////////////// 1159 | bool STUDENT_FILL_OUT_THE_FEEDBACK_FORM_FUNCTION(int choice) 1160 | { 1161 | CLEAR_SCREEN(); 1162 | TITLE(); 1163 | 1164 | string FILE_PATH = "./Feedback Form/Submitted Feedbacks/" + GET_USERNAME() + ".txt"; 1165 | 1166 | if (CHECK_EXISTING_FILE(FILE_PATH.c_str())) 1167 | { 1168 | cout << "\n\n\n"; 1169 | cout << " __________________________________________________\n"; 1170 | cout << " | FEEDBACK ALREADY SUBMITTED...! \n"; 1171 | cout << " |__________________________________________________\n"; 1172 | return FALSE; 1173 | } 1174 | 1175 | string QUESTION_LINE; 1176 | fstream READ_FEEDBACK_FORM; 1177 | fstream WRITE_FEEDBACK_ANSWERS; 1178 | READ_FEEDBACK_FORM.open("./Feedback Form/Feedback Form.txt", ios::in); 1179 | WRITE_FEEDBACK_ANSWERS.open(FILE_PATH.c_str(), ios::app); 1180 | { 1181 | while (getline(READ_FEEDBACK_FORM, QUESTION_LINE)) 1182 | { 1183 | cout << QUESTION_LINE << endl << " 1. STRONGLY AGREE 2. AGREE 3. NEUTRAL 4. DISAGREE 5. STRONGLY DISAGREE" << endl; 1184 | 1185 | CHOICE_SELECTION: 1186 | cout << endl << "ENTER A CHOICE: "; 1187 | 1188 | ////////////////////////////////////////////////////////// 1189 | try //.... Exception Handling incase of Wrong Input ...// 1190 | { ////////////////////////////////////////////////////////// 1191 | cin >> choice; 1192 | cout << endl; 1193 | if ((choice <= 5) && (choice >= 1)) 1194 | { 1195 | if (choice == 1) 1196 | { 1197 | WRITE_FEEDBACK_ANSWERS << QUESTION_LINE << endl << " 1. STRONGLY AGREE" << endl << endl; 1198 | } 1199 | if (choice == 2) 1200 | { 1201 | WRITE_FEEDBACK_ANSWERS << QUESTION_LINE << endl << " 2. AGREE" << endl << endl; 1202 | } 1203 | if (choice == 3) 1204 | { 1205 | WRITE_FEEDBACK_ANSWERS << QUESTION_LINE << endl << " 3. NEUTRAL" << endl << endl; 1206 | } 1207 | if (choice == 4) 1208 | { 1209 | WRITE_FEEDBACK_ANSWERS << QUESTION_LINE << endl << " 4. DISAGREE" << endl << endl; 1210 | } 1211 | if (choice == 5) 1212 | { 1213 | WRITE_FEEDBACK_ANSWERS << QUESTION_LINE << endl << " 5. STRONGLY DISAGREE" << endl << endl; 1214 | } 1215 | } 1216 | else 1217 | { 1218 | throw choice; 1219 | } 1220 | } 1221 | catch (int choice) 1222 | { 1223 | cout << '\a'; 1224 | cin.clear(); 1225 | cin.ignore(256, '\n'); 1226 | choice = 0; 1227 | for (int i = 1; i > 0; i--) 1228 | { 1229 | cout << "\n\n\n"; 1230 | cout << " __________________________________________________\n"; 1231 | cout << " | Wrong Choice, TRY AGAIN in " << i << " seconds...!!!\n"; 1232 | cout << " |__________________________________________________\n"; 1233 | Sleep(1000); 1234 | cout << endl << endl << " ERROR: INVALID INPUT: ENTER AGAIN: "; 1235 | } 1236 | goto CHOICE_SELECTION; 1237 | } 1238 | } 1239 | } 1240 | READ_FEEDBACK_FORM.close(); 1241 | WRITE_FEEDBACK_ANSWERS.close(); 1242 | return true; 1243 | 1244 | } 1245 | /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 1246 | 1247 | 1248 | /////////////////////////////////////// 3. VIEW YOUR SUBMITTED FEEDBACK [OVERLOADED] /////////////////////////////////////////// 1249 | bool PRINT_SUBMITTED_FEEDBACK_FORM() 1250 | { 1251 | CLEAR_SCREEN(); 1252 | TITLE(); 1253 | 1254 | string FILE_PATH = "./Feedback Form/Submitted Feedbacks/" + GET_USERNAME() + ".txt"; 1255 | 1256 | if (!CHECK_EXISTING_FILE(FILE_PATH.c_str())) 1257 | { 1258 | cout << "\n\n\n"; 1259 | cout << " __________________________________________________\n"; 1260 | cout << " | No Feedback Submitted by this student yet... \n"; 1261 | cout << " |__________________________________________________\n"; 1262 | return FALSE; 1263 | } 1264 | 1265 | else 1266 | { 1267 | string SUBMITTED_FEEDBACK_FORM; 1268 | fstream READ; 1269 | READ.open(FILE_PATH.c_str(), ios::in); 1270 | { 1271 | while (getline(READ, SUBMITTED_FEEDBACK_FORM)) 1272 | { 1273 | cout << SUBMITTED_FEEDBACK_FORM << endl; 1274 | } 1275 | } 1276 | READ.close(); 1277 | return TRUE; 1278 | } 1279 | 1280 | } 1281 | /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 1282 | 1283 | 1284 | /////////////////////////////////////// 4. CHANGE YOUR PASSWORD [OVERLOADED] /////////////////////////////////////////// 1285 | void CHANGE_PASSWORD() 1286 | { 1287 | CLEAR_SCREEN(); 1288 | TITLE(); 1289 | cout << " ________________________________________________\n"; 1290 | cout << " | CHANGE YOUR PASSWORD |\n"; 1291 | cout << " |________________________________________________|\n"; 1292 | cout << "\n"; 1293 | 1294 | string NEW_PASSWORD; 1295 | cout<<" >> Enter your NEW PASSWORD: "; 1296 | cin >> NEW_PASSWORD; 1297 | 1298 | string FILE_PATH = "./Students/" + GET_USERNAME() + ".txt"; 1299 | ofstream OVER_WRITE; 1300 | OVER_WRITE.open(FILE_PATH.c_str()); 1301 | { 1302 | OVER_WRITE<