"C++ Book an appointment 2. Change an appointment 3. Cancel an appointment 4. View appointment by last name 5. View all appointment" Code Answer's

You're definitely familiar with the best coding language C++ that developers use to develop their projects and they get all their queries like "C++ Book an appointment 2. Change an appointment 3. Cancel an appointment 4. View appointment by last name 5. View all appointment" answered properly. Developers are finding an appropriate answer about C++ Book an appointment 2. Change an appointment 3. Cancel an appointment 4. View appointment by last name 5. View all appointment related to the C++ coding language. By visiting this online portal developers get answers concerning C++ codes question like C++ Book an appointment 2. Change an appointment 3. Cancel an appointment 4. View appointment by last name 5. View all appointment. Enter your desired code related query in the search bar and get every piece of information about C++ code related question on C++ Book an appointment 2. Change an appointment 3. Cancel an appointment 4. View appointment by last name 5. View all appointment. 

C++ Book an appointment 2. Change an appointment 3. Cancel an appointment 4. View appointment by last name 5. View all appointment

By Handsome HamsterHandsome Hamster on Mar 03, 2021
using namespace std;

#include <iostream>
#include <conio.h>
#include <fstream>
#include <iomanip>
#include <string>
#include <stdlib.h>


const unsigned short numComponents = 10;

unsigned short prices[numComponents];
string treatments[numComponents];

void welcome ();
void showMenu ();
void priceList ();
void makeAppointment ();
void openAppointments();
void checkTime();

char choice;
int day;
string date, customer, treatment;
string appBook[5][8][3];

int main () {
       welcome ();
       openAppointments();

   do {
        showMenu ();
        switch (toupper(choice)) {
            case 'A': makeAppointment(); break;
            case 'P': priceList (); break;
            case 'Q': cout << "\\ntThank you for using this application.\n"; break;
            default: cout << "\t\a\a\aInvalid choice.\n\n";
        }
   }
   while (toupper(choice) != 'Q');
   return 0;

}

void welcome () {
// Welcome the user to the program.

     cout << "\n\t\t\t   **************************\n\t\t\t   Curl Up and Dye Hair Salon\n\t\t\t   **************************\n\n";
}

void showMenu () {
// Output the menu to the user.

    cout << "\n\n\t\tSelect one of the following options:\n"
         << "\t\t------------------------------------\n\n"
         << "\t\tA:Make an Appointment\n"
         << "\t\tP: Price List\n"
         << "\t\t\t";
     cin >> choice;
    }

void openAppointments(){

}

void priceList () {
/*
   Reads in the treatments and corresponding prices from the Treatments.txt and PriceList.txt files respectively. The prices are held in the array "prices"
   and the treatments are stored in the array "treatments". You do not need to know how to do this, this is simply for convenience.
*/

    ifstream treatmentFile("treatments.txt"), priceFile("priceList.txt");

    for (unsigned short i = 0; i<numComponents-1; i++) {
       getline (treatmentFile,treatments[i],'\n');
       priceFile >> prices[i];
       }
    treatmentFile.close ();
    priceFile.close ();
    }

void printPrices (string treatments, unsigned short prices[]) {

    for (unsigned short i = 0; i < numComponents; i++) {
      cout << setw (50) << setiosflags(ios::left) << treatments[i] << prices[i] << "\n";
    if (i% 20 == 0 && i != 0)
         getch ();
      }

    }

void showDays () {
// Output the menu to the user.

    cout << "\n\n\t\tSelect one of the following days:\n"
         << "\t\t------------------------------------\n\n"
         << "\t\t0:Monday\n"
         << "\t\t1:Tuesday\n"
         << "\t\t2:Wednesday\n"
         << "\t\t3:Thursday\n"
         << "\t\t4:Friday\n"
         << "\t\t\t";
     cin >> day;
    }

void makeAppointment () {
// Asks the user for the day of the appointment
    showDays();
    switch(day){
    case 0:
        date = "Monday";
        checkTime();
        break;
    case 1:
        date = "Tuesday";
        checkTime();
        break;
    case 2:
        date = "Wednesday";
        checkTime();
        break;
    case 3:
        date = "Thursday";
        checkTime();
        break;
    case 4:
        date = "Friday";
        checkTime();
        break;
    default:
        showMenu();
        break;
    }
}

void checkTime(){
// Checks the arrays for free time and stores the inputs.
    int time;
    bool checkSum = false;

    do{
        cout << "\n\n\t\tEnter time for appointment:\n"
         << "\t\t------------------------------------\n\n";
        cin >> time;
        if(appBook[day][time-9][0] == ""){
           cout << "\n\n\t\tEnter the customer name:\n"
                 << "\t\t------------------------------------\n\n";
            cin >> customer;
            cout << "\n\n\t\tEnter the treatment for "<< customer <<":\n"
                 << "\t\t------------------------------------\n\n";
            cin >> treatment;
            appBook[day][time-9][0] = date;
            appBook[day][time-9][1] = customer;
            appBook[day][time-9][2] = treatment;
            checkSum = true;
        } else {
            cout << "\t\t-----------------------\n\n"
                 << "\n\n\t\tThat time is taken!\n"
                 << "\t\t-----------------------\n\n";
        }
    }while(checkSum == false);

    cout << appBook[day][time-9][1] << " is getting a " << appBook[day][time-9][2] << " at " << time << " on " << appBook[day][time-9][0];
}

Source: www.cplusplus.com

Add Comment

0

All those coders who are working on the C++ based application and are stuck on C++ Book an appointment 2. Change an appointment 3. Cancel an appointment 4. View appointment by last name 5. View all appointment can get a collection of related answers to their query. Programmers need to enter their query on C++ Book an appointment 2. Change an appointment 3. Cancel an appointment 4. View appointment by last name 5. View all appointment related to C++ code and they'll get their ambiguities clear immediately. On our webpage, there are tutorials about C++ Book an appointment 2. Change an appointment 3. Cancel an appointment 4. View appointment by last name 5. View all appointment for the programmers working on C++ code while coding their module. Coders are also allowed to rectify already present answers of C++ Book an appointment 2. Change an appointment 3. Cancel an appointment 4. View appointment by last name 5. View all appointment while working on the C++ language code. Developers can add up suggestions if they deem fit any other answer relating to "C++ Book an appointment 2. Change an appointment 3. Cancel an appointment 4. View appointment by last name 5. View all appointment". Visit this developer's friendly online web community, CodeProZone, and get your queries like C++ Book an appointment 2. Change an appointment 3. Cancel an appointment 4. View appointment by last name 5. View all appointment resolved professionally and stay updated to the latest C++ updates. 

C++ answers related to "C++ Book an appointment 2. Change an appointment 3. Cancel an appointment 4. View appointment by last name 5. View all appointment"

View All C++ queries

C++ queries related to "C++ Book an appointment 2. Change an appointment 3. Cancel an appointment 4. View appointment by last name 5. View all appointment"

C++ Book an appointment 2. Change an appointment 3. Cancel an appointment 4. View appointment by last name 5. View all appointment run c++ files on chrome book Write a C++ program using class and objects. You have to define multiple-member functions outside class and all those functions will be the same name find last element of an array c++ access last element in vector in c++ remove last character from string c++ dev c++ tahe last word error c++ how to loop through a vector but not the last element swap first and last character of string in c++ remove or erase first and last character of string c++ c++ get last character of string how to get last element of set in c++ code to find the last digit of a number vector last c++ cpp get last element of vector c++ get last element in array C++ remove last element from array find last occurrence of character in string c++ find last digit of number delete last char of string C++ get first and last character of string c++ how to find last character of string in c++ c++ remove last element from vector c++ erase last element of set remove the last element of a vector in cpp c++ access second last element of vector how to get last element of set how to access last element of set in c++ C++ drop last element of list c++ last element of array get last element of stack c++ get the last element of an array c++ Sum of first and last digit of a number in C++ access last element of set c++ How to get the last element of an array in C++ using std::array c++ get last element in vector remove last letter in string c++ c++ how to skip the last element of vector gfg bottom view of tree gfg right view of tree how to get the player view point location and rotation in ue4 c++ gfg left view of tree gfg top view of tree top view of binary tree c++ ue4 set view target with blend c++ Print Nodes in Top View of Binary Tree c++ does not name a type cout does not name a type Name one example of a “decider” program that you regularly encounter in real life. eosio name to string how to get name of caller function c++ name of header file of string library c++ c++ get type name of object how to get os name in c++ how to complie c++ to spesific name using terminal how to acess superclass properties with the same name in c++ c++ method name error: invalid use of template-name without an argument list cpp class access array member by different name void does not a name a type in cpp how to get PID by process name c++ c++ typeid get type name how to get PID by name in c++ typeid().name() in c++ Parse error. Expected a command name, got unquoted argument with text "//". how to put your name on c ++ change int to string cpp how to change a string to an float in c++ c++ change console color change integer to string c++ how to change colour image to grey in opencv c++ how to change the icon of an exe in c++ how to change the type of something in c++ platform io change baud rate find all occurrences of a substring in a string c++ how to grab all of user input c++ c++ initialize array with all zeros all of the stars lyrics cpp goiver all the map values c++ generate all subsets convert all characters in string to uppercase c++ Write a program to find the sum of all sub-arrays of a given integer array. All data types in C++ prints all the keys and values in a map c++ initialize all elements of vector to 0 c++ round all columns in R dataframe to 3 digits all pair shortest path algorithm in c with program initialize vector to all zeros c++ convert all strings in vector to lowercase or uppercase c++ print all unique subsets find all the palindrome substring in a given string print all substrings in c++ c language all keywords in string how to assign all elements of vector in c++ structure in c++ all in one all trigonometric functions with complex numbers in c/c++ how to find all permutations of n distinct integers in c++ std::map get all keys how to print all numbers in an integer in c++ how to round all numeric column types in r

Browse Other Code Languages

CodeProZone