Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream> //Includes the Input/Output Framework
- #include <string> //Includes the String Framework to Allow the use of String Variables
- using namespace std;
- int bookingNumber; //Variable Declared
- int main();
- string firstName = "None", lastName = "None", fullName = "None", emailAddress = "None", contactNumber = "None", itemType = "None", itemMake = "None", itemModel = "None", deviceError = "None", elaborate = "None"; //Global Variables for the booking systems, so that they can be used in different functions
- /*Void Functions used as banners for program formatting*/
- void welcomeBanner()
- {
- system("cls");
- cout << "-----------------------" << endl;
- cout << "- Tech-IT Application -" << endl;
- cout << "-----------------------" << endl;
- }
- void helpBanner()
- {
- system("cls");
- cout << "---------------------" << endl;
- cout << "- Tech-IT Help Page -" << endl;
- cout << "---------------------" << endl;
- }
- void bookingBanner()
- {
- system("cls");
- cout << "-----------------------" << endl;
- cout << "- Tech-IT New Booking -" << endl;
- cout << "-----------------------" << endl;
- }
- void previousBanner()
- {
- system("cls");
- cout << "-----------------------------" << endl;
- cout << "Tech-IT Previous Bookings" << endl;
- cout << "-----------------------------" << endl;
- }
- void choiceBanner()
- {
- cout << "-----------------------------" << endl;
- cout << "Enter your preferred choice: ";
- }
- int help() /*Program Help Function*/
- {
- /*Two LOCAL Variables decalred for the goback and switch*/
- int choice;
- char goback, choice1, choice2, choice3, choice4, choice5, choice6, choice7;
- goback: //Declaration for where the goback statement will be looped to
- helpBanner();//Calls helpBanner function
- /*Outputs onto the CLI a Help menu*/
- cout << "" << endl;
- cout << "1. How TO: Add a new record" << endl;
- cout << "2. How TO: View Previous Record" << endl;
- cout << "3. How TO: Clear Previous Record" << endl;
- cout << "4. Go Back: Main Application" << endl;
- cout << "" << endl;
- choiceBanner();//Calls choiceBanner function
- cin >> choice;//Allows user input for their specific choice from the menu
- switch (choice)//Initializes the switch choice statment
- {
- /*First SWITCH Case, where user will get help on how to add a new record.*/
- case 1:
- {
- helpBanner();
- cout << "" << endl;
- cout << "You have chosen..." << endl;
- cout << "How TO: Add a new record" << endl;
- cout << "" << endl;
- cout << "Step 1" << endl;
- cout << "- To add a new record you will have to select option 1 on the main page." << endl;
- cout << "" << endl;
- cout << "Would you like to continue to the next step? (Y/N)" << endl;
- choiceBanner();
- cin >> choice1;
- switch (choice1)
- {
- case 'Y': case 'y':
- {
- welcomeBanner();
- cout << "Step 2" << endl;
- cout << "- Once you have selected that option, you will then be displayed with a disclaimer." << endl;
- cout << "" << endl;
- cout << "Would you like to continue to the next step? (Y/N)" << endl;
- choiceBanner();
- cin >> choice2;
- switch (choice2)
- {
- case 'Y': case 'y':
- {
- welcomeBanner();
- cout << "Step 3" << endl;
- cout << "- After this disclaimer has been agreed to..." << endl;
- cout << "you will then have the ability to add a new record" << endl;
- cout << "" << endl;
- cout << "Would you like to continue to the next step? (Y/N)" << endl;
- choiceBanner();
- cin >> choice3;
- switch (choice3)
- {
- case 'Y': case 'y':
- {
- welcomeBanner();
- cout << "Step 4" << endl;
- cout << "- The first information the new record will take is personal information.\n-First Name\n-Last Name" << endl;
- cout << "" << endl;
- cout << "Would you like to continue to the next step? (Y/N)" << endl;
- choiceBanner();
- cin >> choice4;
- switch (choice4)
- {
- case 'Y': case 'y':
- {
- welcomeBanner();
- cout << "Step 5" << endl;
- cout << "- Once this information has been inputted by the user..." << endl;
- cout << "the user will have to confirm the information is correct." << endl;
- cout << "" << endl;
- cout << "Would you like to continue to the next step? (Y/N)" << endl;
- choiceBanner();
- cin >> choice5;
- switch (choice5)
- {
- case 'Y': case 'y':
- {
- welcomeBanner();
- cout << "Step 6" << endl;
- cout << "- This process will repeat for: \n-Contact Information \n-Device Information \n-Problem Information." << endl;
- cout << "" << endl;
- cout << "Would you like to continue? (Y/N)" << endl;
- choiceBanner();
- cin >> choice6;
- switch (choice6)
- {
- case 'Y': case 'y':
- {
- welcomeBanner();
- }
- case 'N': case 'n':
- {
- welcomeBanner();
- cout << "You have chosen not to progress." << endl;
- cout << "" << endl;
- cout << "Would you like to go back to the help function? (Y/N)" << endl;
- choiceBanner();
- cin >> choice7;
- if ((choice7 == 'Y') || (choice7 == 'y'))
- help();
- else
- welcomeBanner();
- cout << "You have chosen not to go back." << endl;
- cout << "This program will now terminate." << endl;
- cout << "" << endl;
- exit(0);
- break;
- }
- default:
- {
- welcomeBanner();
- cout << "Program Error." << endl;
- cout << "" << endl;
- cout << "Would you like to go back to the help function? (Y/N)" << endl;
- choiceBanner();
- cin >> choice7;
- if ((choice7 == 'Y') || (choice7 == 'y'))
- help();
- else
- welcomeBanner();
- cout << "You have chosen not to go back." << endl;
- cout << "This program will now terminate." << endl;
- cout << "" << endl;
- exit(0);
- break;
- }
- }
- }
- }
- }
- case 'N': case 'n':
- {
- welcomeBanner();
- cout << "You have chosen not to progress." << endl;
- cout << "" << endl;
- cout << "Would you like to go back to the help function? (Y/N)" << endl;
- choiceBanner();
- cin >> choice7;
- if ((choice7 == 'Y') || (choice7 == 'y'))
- help();
- else
- welcomeBanner();
- cout << "You have chosen not to go back." << endl;
- cout << "This program will now terminate." << endl;
- cout << "" << endl;
- exit(0);
- break;
- }
- default:
- {
- welcomeBanner();
- cout << "Program Error." << endl;
- cout << "" << endl;
- cout << "Would you like to go back to the help function? (Y/N)" << endl;
- choiceBanner();
- cin >> choice7;
- if ((choice7 == 'Y') || (choice7 == 'y'))
- help();
- else
- welcomeBanner();
- cout << "You have chosen not to go back." << endl;
- cout << "This program will now terminate." << endl;
- cout << "" << endl;
- exit(0);
- break;
- }
- }
- }
- case 'N': case 'n':
- {
- welcomeBanner();
- cout << "You have chosen not to progress." << endl;
- cout << "" << endl;
- cout << "Would you like to go back to the help function? (Y/N)" << endl;
- choiceBanner();
- cin >> choice7;
- if ((choice7 == 'Y') || (choice7 == 'y'))
- help();
- else
- welcomeBanner();
- cout << "You have chosen not to go back." << endl;
- cout << "This program will now terminate." << endl;
- cout << "" << endl;
- exit(0);
- break;
- }
- default:
- {
- welcomeBanner();
- cout << "Program Error." << endl;
- cout << "" << endl;
- cout << "Would you like to go back to the help function? (Y/N)" << endl;
- choiceBanner();
- cin >> choice7;
- if ((choice7 == 'Y') || (choice7 == 'y'))
- help();
- else
- welcomeBanner();
- cout << "You have chosen not to go back." << endl;
- cout << "This program will now terminate." << endl;
- cout << "" << endl;
- exit(0);
- break;
- }
- }
- }
- case 'N': case 'n':
- {
- welcomeBanner();
- cout << "You have chosen not to progress." << endl;
- cout << "" << endl;
- cout << "Would you like to go back to the help function? (Y/N)" << endl;
- choiceBanner();
- cin >> choice7;
- if ((choice7 == 'Y') || (choice7 == 'y'))
- help();
- else
- welcomeBanner();
- cout << "You have chosen not to go back." << endl;
- cout << "This program will now terminate." << endl;
- cout << "" << endl;
- exit(0);
- break;
- }
- default:
- {
- welcomeBanner();
- cout << "Program Error." << endl;
- cout << "" << endl;
- cout << "Would you like to go back to the help function? (Y/N)" << endl;
- choiceBanner();
- cin >> choice7;
- if ((choice7 == 'Y') || (choice7 == 'y'))
- help();
- else
- welcomeBanner();
- cout << "You have chosen not to go back." << endl;
- cout << "This program will now terminate." << endl;
- cout << "" << endl;
- exit(0);
- break;
- }
- }
- }
- case 'N': case 'n':
- {
- welcomeBanner();
- cout << "You have chosen not to progress." << endl;
- cout << "" << endl;
- cout << "Would you like to go back to the help function? (Y/N)" << endl;
- choiceBanner();
- cin >> choice7;
- if ((choice7 == 'Y') || (choice7 == 'y'))
- help();
- else
- welcomeBanner();
- cout << "You have chosen not to go back." << endl;
- cout << "This program will now terminate." << endl;
- cout << "" << endl;
- exit(0);
- break;
- }
- default:
- {
- welcomeBanner();
- cout << "Program Error." << endl;
- cout << "" << endl;
- cout << "Would you like to go back to the help function? (Y/N)" << endl;
- choiceBanner();
- cin >> choice7;
- if ((choice7 == 'Y') || (choice7 == 'y'))
- help();
- else
- welcomeBanner();
- cout << "You have chosen not to go back." << endl;
- cout << "This program will now terminate." << endl;
- cout << "" << endl;
- exit(0);
- break;
- }
- }
- break;
- }
- /*Second SWITCH Case, where users will get help on how to view the previous record.*/
- case 2:
- {
- helpBanner();
- cout << "You have chosen..." << endl;
- cout << "How TO: View Previous Records" << endl;
- cout << "" << endl;
- cout << "Would you like to go back (Y/N)? ";
- cin >> goback;
- /*Go back for when the user has finished*/
- if ((goback == 'Y') || (goback == 'y'))
- goto goback;
- else
- exit(0);
- break;
- }
- /*Third SWITCH Case, this is where the user will get help on how to clear the previous record*/
- case 3:
- {
- helpBanner();
- cout << "You have chosen..." << endl;
- cout << "How TO: Clear a record" << endl;
- cout << "" << endl;
- cout << "Would you like to go back (Y/N)? ";
- cin >> goback;
- /*Go back for when the user has finished*/
- if ((goback == 'Y') || (goback == 'y'))
- goto goback;
- else
- exit(0);
- break;
- }
- /*Fourth SWITCH Case, this is where the program will go back to int main. (Main Application)*/
- case 4:
- {
- main();
- break;
- }
- /*Default SWITCH Case, where when none of the cases are entered an error message will be displayed*/
- default:
- {
- helpBanner();
- cout << "Program Error." << endl;
- cout << "" << endl;
- cout << "Would you like to go back (Y/N)? ";
- cin >> goback;
- /*Go back for if the user would like to*/
- if ((goback == 'Y') || (goback == 'y'))
- goto goback;
- /*If the user chooses not to go back, the program will end.*/
- else
- cout << "" << endl;
- cout << "This program will now end." << endl;
- exit(0);
- break;
- }
- }
- return 0;
- }
- int newBooking() //Program newBooking Function
- {
- /*Variables decalred for the confirmation of personal details later on*/
- char termsConfirm, nameConfirm, issueConfirm, returnChoice, returnChoice2, returnChoice3;
- int choice;
- startGoBack:
- bookingBanner();//Calls bookingBanner function
- /*Outputs to the CLI for the user to input their First & Last name*/
- cout << "" << endl;
- cout << "Welcome!" << endl;
- cout << "Please read the terms below, before continuing." << endl;
- cout << "" << endl;
- cout << "By agreeing to this contract, you agree to allow Tech-IT\nto diagnose and repair your device. Upon booking your\ndevice in, a 10 GBP booking fee applies, which is NOT\nrefundable. Futher fees will be discussed prior to any\nwork being carried out, which the customer has no obligation\nto continue using our service." << endl;
- cout << "" << endl;
- cout << "Would you like to continue? (Y/N)" << endl;
- cout << "Disclaimer: By continuing you agree to the terms above." << endl;
- choiceBanner();
- cin >> termsConfirm;
- switch (termsConfirm)
- {
- case 'Y': case 'y':
- {
- goto goback;
- break;
- }
- case 'N': case 'n':
- {
- welcomeBanner();
- cout << "You decided not to agree to the terms." << endl;
- cout << "This program will now end" << endl;
- exit(0);
- break;
- }
- }
- goback://Initializes a new goback for the specific function of newBooking
- bookingBanner();
- cout << "Please Fill In The Fields Below." << endl;
- cout << "-----------------------" << endl;
- cout << "" << endl;
- cout << "First Name: ";
- cin >> firstName; //User input (First Name)
- cout << "Last Name: ";
- cin >> lastName; //User input (Last Name)
- fullName = firstName + lastName; //Variable concatenation adds the firstName & lastName together to then be stored as a new variable called fullName
- cout << "-----------------------" << endl;
- /*Confirmation stage to the first part. If the details inputted is incorrect then the program will loop back*/
- cout << "Please confirm that your name is: " << fullName << endl;
- cout << "Enter Answer Here (Y/N): ";
- cin >> nameConfirm;
- if ((nameConfirm == 'Y') || (nameConfirm == 'y'))
- goto carryOn;
- else
- goto goback;
- /*Outputs to the CLI the contact information stage including phone number and email address.*/
- carryOn:
- system("cls");
- cout << "-----------------------" << endl;
- cout << "Contact Information" << endl;
- cout << "-----------------------" << endl;
- cout << "" << endl;
- cout << "Contact Telephone No: ";
- cin >> contactNumber; //User Input
- cout << "Email Address: ";
- cin >> emailAddress; //User Input
- cout << "-----------------------" << endl;
- /*Second confirmation stage. Confirm the contact information is correct.*/
- cout << "Is the information above correct?" << endl;
- cout << "Enter Answer Here (Y/N): ";
- cin >> nameConfirm;
- if ((nameConfirm == 'Y') || (nameConfirm == 'y'))
- goto carryOn2;
- /*If the information is incorrect then the program will loop back and the user would have to start over*/
- else
- goto goback;
- /*Outputs to the CLI the item details which the user is submitting.*/
- carryOn2:
- system("cls");
- cout << "-----------------------" << endl;
- cout << "Item Details" << endl;
- cout << "-----------------------" << endl;
- cout << "Item Type: ";
- cin >> itemType; //User Input
- cout << "Item Make: ";
- cin >> itemMake; //User Input
- cout << "Item Model: ";
- cin >> itemModel; //User Input
- cout << "-----------------------" << endl;
- /*Third confirmation stage. Confirm the Item details is of what the user wants.*/
- cout << "Is the information above correct?" << endl;
- cout << "Enter Answer Here (Y/N): ";
- cin >> nameConfirm;
- if ((nameConfirm == 'Y') || (nameConfirm == 'y'))
- goto carryOn3;
- else
- goto goback;
- /*Outputs to the CLI the problem stage of adding a new booking.*/
- carryOn3:
- system("cls");
- cout << "-----------------------" << endl;
- cout << "Select Your Problem" << endl;
- cout << "-----------------------" << endl;
- cout << "1. Power Issues" << endl;
- cout << "2. Screen Replacement" << endl;
- cout << "3. Peripheral Issues" << endl;
- cout << "4. Storage Issues" << endl;
- cout << "5. Cooling Issues" << endl;
- cout << "6. Other" << endl;
- choiceBanner();//Calls choiceBanner function
- cin >> choice; //User Input
- switch (choice) //Initializes a switch choice statment
- {
- /*Case 1: Power Issues.*/
- case 1:
- {
- deviceError = "Power Issues"; //Assigns a value to the global variable of deviceError
- system("cls"); //Clears the system screen
- /*New Banner for the Issue (Power)*/
- cout << "-----------------------" << endl;
- cout << "Your Issue: Power" << endl;
- cout << "-----------------------" << endl;
- cout << "Please elaborate on your specific issue below." << endl;
- cout << "Input Here: ";
- cin >> elaborate; //Allows user to expand on their issue. Can be left blank too.
- cout << "-----------------------" << endl;
- /*Confirmation of the information the user has inputted.*/
- cout << "Are you happy with the information you added?" << endl;
- cout << "Enter Answer Here (Y/N): ";
- cin >> nameConfirm;
- if ((nameConfirm == 'Y') || (nameConfirm == 'y'))
- goto carryOn4;
- else
- goto carryOn3;
- }
- /*Case 2: Screen Replacement*/
- case 2:
- {
- deviceError = "Screen Replacement"; //Assigns a value to the global variable of deviceError
- system("cls");//Clears the system screen
- /*New Banner for the Issue (Screen Replacement)*/
- cout << "-----------------------" << endl;
- cout << "Your Issue: Screen" << endl;
- cout << "-----------------------" << endl;
- cout << "Please elaborate on your specific issue below." << endl;
- cout << "Input Here: ";
- cin >> elaborate;//Allows user to expand on their issue. Can be left blank too.
- cout << "-----------------------" << endl;
- /*Confirmation of the information the user has inputted.*/
- cout << "Are you happy with the information you added?" << endl;
- cout << "Enter Answer Here (Y/N): ";
- cin >> nameConfirm;
- if ((nameConfirm == 'Y') || (nameConfirm == 'y'))
- goto carryOn4;
- else
- goto carryOn3;
- }
- /*Case 3: Peripheral Issues*/
- case 3:
- {
- deviceError = "Peripheral Issues"; //Assigns a value to the global variable of deviceError
- system("cls"); //Clears the system screen
- /*New Banner for the Issue (Peripheral Issue)*/
- cout << "-----------------------" << endl;
- cout << "Your Issue: Peripheral" << endl;
- cout << "-----------------------" << endl;
- cout << "Please elaborate on your specific issue below." << endl;
- cout << "Input Here: ";
- cin >> elaborate; //Allows user to expand on their issue. Can be left blank too.
- cout << "-----------------------" << endl;
- /*Confirmation of the information the user has inputted.*/
- cout << "Are you happy with the information you added?" << endl;
- cout << "Enter Answer Here (Y/N): ";
- cin >> nameConfirm;
- if ((nameConfirm == 'Y') || (nameConfirm == 'y'))
- goto carryOn4;
- else
- goto carryOn3;
- }
- /*Case 4: Storage Issues*/
- case 4:
- {
- deviceError = "Storage Issues"; //Assigns a value to the global variable of deviceError
- system("cls"); //Clears the system screen
- /*New Banner for the Issue (Storage Issues)*/
- cout << "-----------------------" << endl;
- cout << "Your Issue: Storage" << endl;
- cout << "-----------------------" << endl;
- cout << "Please elaborate on your specific issue below." << endl;
- cout << "Input Here: ";
- cin >> elaborate; //Allows user to expand on their issue. Can be left blank too.
- cout << "-----------------------" << endl;
- /*Confirmation of the information the user has inputted.*/
- cout << "Are you happy with the information you added?" << endl;
- cout << "Enter Answer Here (Y/N): ";
- cin >> nameConfirm;
- if ((nameConfirm == 'Y') || (nameConfirm == 'y'))
- goto carryOn4;
- else
- goto carryOn3;
- }
- /*Case 5: Cooling Issues*/
- case 5:
- {
- deviceError = "Cooling Issues"; //Assigns a value to the global variable of deviceError
- system("cls"); //Clears the system screen
- /*New Banner for the Issue (Cooling Issues)*/
- cout << "-----------------------" << endl;
- cout << "Your Issue: Cooling" << endl;
- cout << "-----------------------" << endl;
- cout << "Please elaborate on your specific issue below." << endl;
- cout << "Input Here: ";
- cin >> elaborate;
- cout << "-----------------------" << endl;
- /*Confirmation of the information the user has inputted.*/
- cout << "Are you happy with the information you added?" << endl;
- cout << "Enter Answer Here (Y/N): ";
- cin >> nameConfirm;
- if ((nameConfirm == 'Y') || (nameConfirm == 'y'))
- goto carryOn4;
- else
- goto carryOn3;
- }
- /*Case 6: Other Issues*/
- case 6:
- {
- deviceError = "Other"; //Assigns a value to the global variable of deviceError
- system("cls"); //Clears the system screen
- /*New Banner for the Issue (Other Issues)*/
- cout << "-----------------------" << endl;
- cout << "Your Issue: Other" << endl;
- cout << "-----------------------" << endl;
- cout << "Please enter your specific issue below." << endl;
- cout << "Input Here: ";
- cin >> elaborate;
- cout << "-----------------------" << endl;
- /*Confirmation of the information the user has inputted.*/
- cout << "Are you happy with the information you added?" << endl;
- cout << "Enter Answer Here (Y/N): ";
- cin >> nameConfirm;
- if ((nameConfirm == 'Y') || (nameConfirm == 'y'))
- goto carryOn4;
- else
- goto carryOn3;
- }
- }
- carryOn4:
- welcomeBanner(); //Calls welcomeBanner Function
- /*Outputs to the CLI that the user has successfully added a new booking*/
- cout << "Completed!" << endl;
- cout << "You have successfully added a new booking" << endl;
- cout << "" << endl;
- /*Asks the user whether they wish to return to the main page*/
- cout << "Do you wish to return Home [Y/N]: ";
- cin >> returnChoice; //User input assigned within variable returnChoice
- switch (returnChoice) //Calls Switch Statement returnChoice
- {
- case 'Y': case 'y': //Case is = Y/y then go back to intMain
- {
- break;
- }
- case 'N': case 'n': //Case = N/n then print text
- {
- welcomeBanner(); //Calls welcomeBanner function
- /*Output to the CLI the following text*/
- cout << "You have decided not to return home." << endl;
- cout << "" << endl;
- cout << "What would you like to do?" << endl;
- cout << "1. Add A New Booking" << endl;
- cout << "2. Terminate Program" << endl;
- choiceBanner(); //Calls choiceBanner function
- cin >> returnChoice2; //User Input
- switch (returnChoice2) //Call Switch Statement returnChoice2
- {
- case 1: //Allow the user to goback and add a new booking
- {
- goto goback;
- break;
- }
- case 2: //Program will terminate if chosen
- {
- cout << "Program Terminated" << endl;
- exit(0);
- break;
- }
- }
- default: //If the two cases are not inputted, then it'll fall back onto the default.
- {
- /*Outputs text to the CLI*/
- cout << "Error." << endl;
- cout << "-----------------------" << endl;
- cout << "Would you like to try again? [Y/N]" << endl;
- choiceBanner(); //Calls choiceBanner
- cin >> returnChoice3; //User Input
- switch (returnChoice3) //Call Switch Statement returnChoice3
- {
- case 1: //If case is equal to '1' then goto carryOn4
- {
- goto carryOn4;
- }
- case 2: //If case is equal to '2' then terminate program
- {
- cout << "Program Terminated" << endl;
- exit(0);
- break;
- }
- default: //If case is NOT equal to the above, then terminate program
- {
- cout << "Program Terminated" << endl;
- exit(0);
- break;
- }
- }
- }
- }
- }
- bookingNumber++; //Once a new booking has been created, it will then increase the bookingNumber variable by '1'
- return 0;
- }
- int previousRecords() //Calls previousRecords function
- {
- char gobackConfirm; //Declares variable
- previousBanner(); //Calls previousBanner
- /*Outputs to the CLI the information from previous booking*/
- cout << "Total Number of Bookings : " << bookingNumber << endl; //Displays number of bookings
- cout << "-----------------------------" << endl;
- /*All the information which as been inputted within the "AddNewBooking" stage, will now all print out*/
- cout << "Last Booking" << endl;
- cout << "" << endl;
- cout << "-----------------------------" << endl;
- cout << "Contact Information" << endl;
- cout << "-----------------------------" << endl;
- cout << "First Name: " << firstName << endl;
- cout << "Last Name: " << lastName << endl;
- cout << "Phone: " << contactNumber << endl;
- cout << "Email: " << emailAddress << endl;
- cout << "-----------------------------" << endl;
- cout << "" << endl;
- cout << "-----------------------------" << endl;
- cout << "Item Details" << endl;
- cout << "-----------------------------" << endl;
- cout << "Item Type: " << itemType << endl;
- cout << "Item Make: " << itemMake << endl;
- cout << "Item Model: " << itemModel << endl;
- cout << "-----------------------------" << endl;
- cout << "" << endl;
- cout << "-----------------------------" << endl;
- cout << "Item Issue" << endl;
- cout << "-----------------------------" << endl;
- cout << "Issue: " << deviceError << endl;
- cout << "Issue Detail: " << elaborate << endl;
- cout << "-----------------------------" << endl;
- cout << "" << endl;
- /*Check whether the user wants to go back to the main application*/
- cout << "Do you wish to go back? Y/N" << endl;
- choiceBanner(); //Calls choiceBanner
- cin >> gobackConfirm; //User Input
- switch (gobackConfirm) //Calls Switch Statement gobackconfirm
- {
- case 'Y': case 'y': //If case is equal to Y/y then break application, and return to intMain
- {
- break;
- }
- case 'N': case 'n': //If case is equal to N/n then terminate program.
- {
- cout << "Program Terminated" << endl;
- exit(0);
- break;
- }
- default: //If input is not equal to any of the above then terminate program.
- {
- cout << "Program Terminated" << endl;
- exit(0);
- break;
- }
- }
- return 0;
- }
- int main() //Calls main function
- {
- int choice; //Declares variable "Choice" for a Switch
- char goback;
- do{ //Initialize a do statement
- goback: //Declares a goback statement
- welcomeBanner(); //Calls welcomeBanner
- /*Outputs to the CLI the following text*/
- cout << "1. New Booking" << endl;
- cout << "2. Previous Records" << endl;
- cout << "3. Clear Previous Record" << endl;
- cout << "4. Tech-IT Help" << endl;
- cout << "5. Terminate Program" << endl;
- choiceBanner(); //Calls choiceBanner
- cin >> choice; //User Input
- switch (choice) //Calls Switch Statement "Choice"
- {
- case 1: //If Case is equal to '1' then Switch to newBooking
- {
- newBooking();
- break;
- }
- case 2: //If Case is equal to '2' then Switch to previousRecords
- {
- previousRecords();
- break;
- }
- case 3:
- {
- welcomeBanner(); //Calls welcomeBanner
- /*Assigns all global variables the value of none*/
- firstName = "None";
- lastName = "None";
- fullName = "None";
- emailAddress = "None";
- contactNumber = "None";
- itemType = "None";
- itemMake = "None";
- itemModel = "None";
- deviceError = "None";
- elaborate = "None";
- cout << "The Previous Record Has Been Cleared!" << endl; //Outputs that all records have been cleared
- bookingNumber--; //Decreases the bookingNumber by 1
- cout << "-----------------------" << endl; //Spacer
- cout << "" << endl; //Line Break
- cout << "" << endl; // Line Break
- cout << "Would you like to go back? (Y/N)" << endl; //User Output
- choiceBanner(); //Calls choiceBanner
- cin >> goback; //User Input
- if ((goback == 'Y') || (goback == 'y')) //If Statement for going back. If it is equal to Y/y then goback
- goto goback;
- else //If it is not equal to Y/y, then program end.
- cout << "This program will now end" << endl;
- exit(0);
- break;
- }
- case 4: //If Case is equal to '3' then Switch to help
- {
- help();
- break;
- }
- case 5: //If Case is equal to '4' then output following
- {
- welcomeBanner(); //Calls welcomeBanner
- cout << "This program will now end." << endl; //Outputs "Program End"
- exit(0); //Terminate Program
- }
- }
- } while ((choice != 1) || (choice != 2) || (choice != 3) || (choice != 4)|| (choice != 5)); //End Do/While. If the choice is NOT equal to 1/2/3 then go back to where the "do" was declared.
- goto goback; //Goback for when intMain is called from a function above.
- return 0; //End Program
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement