Question: pls help me with c++ code asap Define a class called Person. It has two private data members: firstName and lastName with char array as
Define a class called Person. It has two private data members: firstName and lastName with char array as data type; and two public member functions: setName(char*, char *) and printName(). The function setName sets the first name and last name. The function printName prints last name followed by a comma and then first name. In the main program, - declare an array of objects called student' with type Person and 20 elements - use a while loop to repeatedly prompt user to input the name using cin.getline call strtok two times to separate the first name and last name call setName to set the data members for each element in the student' array of objects (you may assume the user enters exactly two words). - after the user enters "exit", call the printName() function for each element in the 'student' array of objects which has values inputted. If no names are entered, output an appropriate error message. Suggested screen design: Enter full name for student 1 (exit to end): John Smith Enter full name for student 2 (exit to end) : William Derrick Enter full name for Student 3 (exit to end): Anna Grant Enter full name for student 4 (exit to end) : exit Last Name Smith, Derrick, Grant, First Name John William Anna
Step by Step Solution
There are 3 Steps involved in it
Heres a C code to implement the given problem statement cpp include include using namespace std clas... View full answer
Get step-by-step solutions from verified subject matter experts
