Answered step by step
Verified Expert Solution
Question
1 Approved Answer
in c++, Define a class called phoneBook which has four data members and two member functions: char name[20], int area, int prefix, int line, setPhone(char
in c++, Define a class called phoneBook which has four data members and two member functions: char name[20], int area, int prefix, int line, setPhone(char *) to initialize data members and printPhone() to output data in the following format (see output). Then write the main function to declare an object, use while loop to prompt user to input a sentence (quit to end), call setPhone() and printPhone( ) for the object. You can assume user will input correct format. The sample output is Enter your name and phone number (quit to end): John 999999999 John 999999999 Enter your name and phone number (quit to end): Pauk 5555555555 Pauk 5555555555 Enter your name and phone number (quit to end): quit The END Hint: first use getline to pick up the whole sentence, use strcmp to test whether it is quit, then call two member functions. In the member function setName(), use strtok_s to separate the sentence to four parts, use atoi to convert a string to integer. in c++, Define a class called phoneBook which has four data members and two member functions: char name[20], int area, int prefix, int line, setPhone(char *) to initialize data members and printPhone() to output data in the following format (see output). Then write the main function to declare an object, use while loop to prompt user to input a sentence (quit to end), call setPhone() and printPhone( ) for the object. You can assume user will input correct format. The sample output is Enter your name and phone number (quit to end): John 999999999 John 999999999 Enter your name and phone number (quit to end): Pauk 5555555555 Pauk 5555555555 Enter your name and phone number (quit to end): quit The END Hint: first use getline to pick up the whole sentence, use strcmp to test whether it is quit, then call two member functions. In the member function setName(), use strtok_s to separate the sentence to four parts, use atoi to convert a string to integer
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started