Answered step by step
Verified Expert Solution
Link Copied!

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

image text in transcribed

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Design And SQL For DB2

Authors: James Cooper

1st Edition

1583473572, 978-1583473573

More Books

Students also viewed these Databases questions

Question

U11 Informing Industry: Publicizing Contract Actions 317

Answered: 1 week ago

Question

=+Are there shop stewards?

Answered: 1 week ago