Answered step by step
Verified Expert Solution
Question
1 Approved Answer
In C++ 18.3 Homework 3 This program will store a roster of most popular videos with kittens. The roster can include at most 10 kittens.
In C++
18.3 Homework 3 This program will store a roster of most popular videos with kittens. The roster can include at most 10 kittens. You will implement structures to handle kitten information. You will also use functions to manipulate the structure. (1) Create a structure kitten. The structure should contain the following attributes name; string color; string score; integer Important! The name of the structure and each of its field must match exactly for the program to work and be graded correctly. (2) Create a struct roster. This struct should contain the following attributes: kittens: an array of struct kitten, with size 10 size; int. This variable will be updated based on the current number of kittens in the roster. In main(), create a roster called kitten Roster. This will store your kitten roster. (3) Implement function printMenu(). This function prints out a menu of options for the user to modify the roster. Each option is represented by a single character. Ex: MENU a - Add kitten d - Delete kitten u - Update kitten color and cuteness score f - Find kitten 1 - Load kitten info from file s - Save kitten info to file 0 - Output roster q - Quit Choose an option: After creating a roster from file, the program outputs the menu. The program will continue to output the menu, until the user chooses the option Quit. If user chooses an option that doesn't exist, display error message Invalid option. Please try again. You can safely assume that user will only enter lower-case letters for option. (4) Implement a function findKitten(). This function takes two arguments: a string name, and a roster struct. If the kitten's name is in the roster, return the position of the kitten in roster. Otherwise, return -1. (5) Implement a function addKitten. This function takes two arguments: a kitten struct and a roster struct. If the roster is full, display error message Impossible to add new kitten: roster is full. Otherwise, it will add the new kitten to the end of the roster and display the message. The size of the roster will be updated accordingly. Successfully added new kitten to roster. (6) Implement function delete Kitten. This function takes string name and a roster struct as arguments. It deletes kitten with the same name in roster (i.e., remove the kitten from the roster. You can use findKitten to check if the kitten exists in the roster. If kitten is not found, return false. Otherwise, delete the kitten, and return false. Remember to update the size of the roster accordingly and pay attention not to leave unused spaces in the roster array. (7) Implement function getkittenFromFile(). This function takes two arguments: the name of a file that stores kitten info, and a struct roster. The function reads the file, and stores kittens info into roster The format of the file is as follows a sample text file is provided as an example):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