Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <istream>
- #include <string>
- using namespace std;
- struct inquiry {
- string number;
- string name;
- int age;
- string date;
- int phone;
- string address;
- string targetIntake;
- string followup1;
- string followup2;
- string feedback;
- };
- inquiry inqArr[20];
- int nextLoc = 0;
- //mainmenu
- void mainMenu();
- //view inquiry
- void viewAll();
- void searchName(string searchKey);
- void searchNo(string searchKey);
- //inquiry modifications
- void addNewInquiry(int n);
- void editInq(string searchKey);
- void deleteInq(string searchKey);
- //followups
- void updateFollowup1(string searchKey);
- void updateFollowup2(string searchKey);
- void updateFollowup3(string searchKey);
- void updateFinalfb(string searchKey);
- //User verification
- int main() {
- string uname, passwd;
- cout << "Enter your username: ";
- cin >> uname;
- cout << "Enter your password: ";
- cin >> passwd;
- if (uname == "1" & passwd == "1") {
- mainMenu();
- }
- else {
- cout << "Invalid Username or Password" << endl;
- }
- system("pause");
- }
- //Main Menu
- void mainMenu() {
- string ans = "x";
- do {
- system("cls");
- int opt;
- string searchKey;
- cout << "==================Main Menu======================" << endl;
- cout << "1. View Previous Inquiries " << endl;
- cout << "2. Add New Inquiry" << endl;
- cout << "3. Edit/Delete an Inquiry" << endl;
- cout << "4. Update FOLLOW-UPs" << endl;
- cout << "5. Update Final Feedback" << endl;
- cout << "6. Logout" << endl;
- cout << "Enter Your Option: ";
- cin >> opt;
- switch (opt) {
- case 1:
- do {
- system("cls");
- int opt;
- cout << "1. View All Inquiries" << endl;
- cout << "2. Search By Number" << endl;
- cout << "3. Search By Name" << endl;
- cout << "9. Back to Mainmenu" << endl;
- cout << "Enter Your Option: ";
- cin >> opt;
- switch (opt)
- {
- case 1:
- viewAll();
- break;
- case 2:
- cout << "Enter the Inquiry Number : " << endl;
- cin >> searchKey;
- searchNo(searchKey);
- break;
- case 3:
- cout << "Enter the Inquirer name : " << endl;
- cin >> searchKey;
- searchName(searchKey);
- break;
- case 9:
- mainMenu();
- default:
- cout << "Invalid Option" << endl;
- break;
- }
- cout << "Do you want to continue [Y/N]: ";
- cin >> ans;
- } while (ans == "y" | ans == "Y");
- break;
- case 2:
- system("cls");
- int n;
- cout << "How many inquaries do you want to add : ";
- cin >> n;
- addNewInquiry(n);
- break;
- case 3:
- do {
- system("cls");
- int opt;
- cout << "1. Edit an Inquiry" << endl;
- cout << "2. Delete an Inquiry" << endl;
- cout << "3. Delete all Inquiries" << endl;
- cout << "9. Back to Mainmenu" << endl;
- cout << "Enter Your Option: ";
- cin >> opt;
- switch (opt)
- {
- case 1:
- cout << "Enter the Inquiry Number : " << endl;
- cin >> searchKey;
- editInq(searchKey);
- break;
- case 2:
- cout << "Enter the Inquiry Number : " << endl;
- cin >> searchKey;
- deleteInq(searchKey);
- break;
- case 9:
- mainMenu();
- default:
- cout << "Invalid Option" << endl;
- break;
- }
- cout << "Do you want to continue [Y/N]: ";
- cin >> ans;
- } while (ans == "y" | ans == "Y");
- break;
- case 4:
- do {
- system("cls");
- int opt;
- cout << "1. Update First Followup" << endl;
- cout << "2. Update second Followup" << endl;
- cout << "3. update followups and feedback" << endl;
- cout << "9. Back to Mainmenu" << endl;
- cout << "Enter Your Option: ";
- cin >> opt;
- switch (opt)
- {
- case 1:
- cout << "Enter the Inquiry Number : " << endl;
- cin >> searchKey;
- updateFollowup1(searchKey);
- break;
- case 2:
- cout << "Enter the Inquiry Number : " << endl;
- cin >> searchKey;
- updateFollowup2(searchKey);
- break;
- case 3:
- cout << "Enter the Inquiry Number : " << endl;
- cin >> searchKey;
- updateFollowup3(searchKey);
- break;
- case 9:
- mainMenu();
- default:
- cout << "Invalid Option" << endl;
- break;
- }
- cout << "Do you want to continue [Y/N]: ";
- cin >> ans;
- } while (ans == "y" | ans == "Y");
- break;
- break;
- case 5:
- cout << "Enter the Inquiry Number : " << endl;
- cin >> searchKey;
- updateFinalfb(searchKey);
- break;
- case 6:
- main();
- break;
- default:
- cout << "Invalid Option" << endl;
- break;
- }
- cout << "Do you want to continue [Y/N]: ";
- cin >> ans;
- } while (ans == "y" | ans == "Y");
- }
- //main menu end
- //view all inquiry
- void viewAll() {
- system("cls");
- for (int i = 0; i<nextLoc; i++) {
- cout << "============================================" << endl;
- cout << "Inquiry Number : " << inqArr[i].number << endl;
- cout << "Inquirer Name : " << inqArr[i].name << endl;
- cout << "Date of Inquiry : " << inqArr[i].date << endl;
- cout << "Age : " << inqArr[i].age << endl;
- cout << "Phone Number : " << inqArr[i].phone << endl;
- cout << "Address : " << inqArr[i].address << endl;
- cout << "Targeted Intake : " << inqArr[i].targetIntake << endl;
- cout << "Follow-Up 1 : " << inqArr[i].followup1 << endl;
- cout << "Follow-Up 2 : " << inqArr[i].followup2 << endl;
- cout << "FeedBack : " << inqArr[i].feedback << endl;
- cout << "============================================" << endl;
- }
- }
- //search by inquiry number
- void searchNo(string searchKey) {
- bool flag = false;
- int i;
- for (i = 0; i<nextLoc; i++) {
- if (inqArr[i].number == searchKey) {
- flag = true;
- break;
- }
- }
- if (flag) {
- cout << "============================================" << endl;
- cout << "Inquirer Name : " << inqArr[i].name << endl;
- cout << "Inquiry Number : " << inqArr[i].number << endl;
- cout << "Date of Inquiry : " << inqArr[i].date << endl;
- cout << "Age : " << inqArr[i].age << endl;
- cout << "Phone Number : " << inqArr[i].phone << endl;
- cout << "Address : " << inqArr[i].address << endl;
- cout << "Targeted Intake : " << inqArr[i].targetIntake << endl;
- cout << "Follow-Up 1 : " << inqArr[i].followup1 << endl;
- cout << "Follow-Up 2 : " << inqArr[i].followup2 << endl;
- cout << "FeedBack : " << inqArr[i].feedback << endl;
- cout << "============================================" << endl;
- }
- }
- //add new inq
- void addNewInquiry(int n) {
- for (int i = nextLoc; i<(nextLoc + n); i++) {
- cout << "============================================" << endl;
- inquiry inqObj;
- cout << "Inquiry Number : ";
- cin >> inqObj.number;
- cout << "Inquirer Name : ";
- cin.ignore();
- getline(cin, inqObj.name);
- cout << "Date of Inquiry : ";
- cin >> inqObj.date;
- cout << "Age : ";
- cin >> inqObj.age;
- cout << "Phone Number : ";
- cin >> inqObj.phone;
- cout << "Address : ";
- cin.ignore();
- getline(cin, inqObj.address);
- cout << "Targeted Intake : ";
- cin >> inqObj.targetIntake;
- inqArr[i] = inqObj;
- cout << "============================================" << endl;
- }
- nextLoc = nextLoc + n;
- }
- //edit an Inquiry
- void editInq(string searchKey) {
- bool flag = false;
- int i;
- for (i = 0; i<nextLoc; i++) {
- if (inqArr[i].number == searchKey) {
- flag = true;
- break;
- }
- }
- if (flag) {
- cout << "============================================" << endl;
- inquiry inqObj;
- inqObj.number = inqArr[i].number;
- cout << "Inquirer Name : ";
- cin.ignore();
- getline(cin, inqObj.name);
- cout << "Age : ";
- cin >> inqObj.age;
- cout << "Phone Number : ";
- cin >> inqObj.phone;
- cout << "Address : ";
- cin.ignore();
- getline(cin, inqObj.address);
- cout << "Targeted Intake : ";
- cin >> inqObj.targetIntake;
- inqArr[i] = inqObj;
- cout << "============================================" << endl;
- }
- }
- //search by name
- void searchName(string searchKey) {
- bool flag = false;
- int i;
- for (i = 0; i<nextLoc; i++) {
- if (inqArr[i].name == searchKey) {
- flag = true;
- break;
- }
- }
- if (flag) {
- cout << "============================================" << endl;
- cout << "Inquirer Name : " << inqArr[i].name << endl;
- cout << "Inquiry Number : " << inqArr[i].number << endl;
- cout << "Date of Inquiry : " << inqArr[i].date << endl;
- cout << "Age : " << inqArr[i].age << endl;
- cout << "Phone Number : " << inqArr[i].phone << endl;
- cout << "Address : " << inqArr[i].address << endl;
- cout << "Targeted Intake : " << inqArr[i].targetIntake << endl;
- cout << "Follow-Up 1 : " << inqArr[i].followup1 << endl;
- cout << "Follow-Up 2 : " << inqArr[i].followup2 << endl;
- cout << "FeedBack : " << inqArr[i].feedback << endl;
- cout << "============================================" << endl;
- }
- }
- //delete an inquiry
- void deleteInq(string searchKey) {
- bool flag = false;
- int i;
- for (i = 0; i<nextLoc; i++) {
- if (inqArr[i].number == searchKey) {
- flag = true;
- break;
- }
- }
- if (flag) {
- cout << "================= Deleting.... ===================" << endl;
- int shift = i;
- for (; shift<nextLoc; shift++) {
- inqArr[shift] = inqArr[shift + 1];
- }
- nextLoc--;
- cout << "================= Deleted! ======================" << endl;
- }
- }
- // update followups
- void updateFollowup1(string searchKey) {
- bool flag = false;
- int i;
- for (i = 0; i<nextLoc; i++) {
- if (inqArr[i].number == searchKey) {
- flag = true;
- break;
- }
- }
- if (flag) {
- cout << "============================================" << endl;
- inquiry inqObj;
- inqObj.number = inqArr[i].number;
- cout << "Enter Follow-up 1 : ";
- cin.ignore();
- getline(cin, inqObj.followup1);
- inqArr[i] = inqObj;
- cout << "============================================" << endl;
- }
- }
- void updateFollowup2(string searchKey) {
- bool flag = false;
- int i;
- for (i = 0; i<nextLoc; i++) {
- if (inqArr[i].number == searchKey) {
- flag = true;
- break;
- }
- }
- if (flag) {
- cout << "============================================" << endl;
- cout << "Inquiry Number : " << inqArr[i].number << endl;
- cout << "Inquirer Name : " << inqArr[i].name << endl;
- inquiry inqObj;
- inqObj.number = inqArr[i].number;
- cout << "Enter Follow-up 2 : ";
- cin.ignore();
- getline(cin, inqObj.followup2);
- cout << "============================================" << endl;
- }
- }
- void updateFollowup3(string searchKey) {
- bool flag = false;
- int i;
- for (i = 0; i<nextLoc; i++) {
- if (inqArr[i].number == searchKey) {
- flag = true;
- break;
- }
- }
- if (flag) {
- cout << "============================================" << endl;
- inquiry inqObj;
- inqObj.number = inqArr[i].number;
- cout << "Enter Follow-up 1 : ";
- cin.ignore();
- getline(cin, inqObj.followup1);
- cout << "Enter Follow-up 2 : ";
- cin.ignore();
- getline(cin, inqObj.followup2);
- cout << "Final Feedback : ";
- cin.ignore();
- getline(cin, inqObj.feedback);
- inqArr[i] = inqObj;
- cout << "============================================" << endl;
- }
- }
- void updateFinalfb(string searchKey) {
- bool flag = false;
- int i;
- for (i = 0; i<nextLoc; i++) {
- if (inqArr[i].number == searchKey) {
- flag = true;
- break;
- }
- }
- if (flag) {
- cout << "============================================" << endl;
- inquiry inqObj;
- inqObj.number = inqArr[i].number;
- cout << "Final Feedback : ";
- cin.ignore();
- getline(cin, inqObj.feedback);
- inqArr[i] = inqObj;
- cout << "============================================" << endl;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement