Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Here is code in c++. I need a function that when I ask the user what cat the want to see, they will type in

Here is code in c++. I need a function that when I ask the user what cat the want to see, they will type in the cats name and it will bring up the rest of the information for it. So, if it asks 'What cat do you want to know about?" The user would type in one of the names that's already provided, like "Lulu". Then it would return the information about "Lulu" (name,color,size) the information is hard coded so i just need to find a way to pull specific structure info from the array. There will be no other user input other then typing the cats name and then see the rest of the information about that specific cat.

#include using namespace std;

struct cat{

string name;

string color;

int size; };

int main() {

const int SIZE=3;

cat values[SIZE];

int choice;

values[0].name="Chad";

values[0].color="Orange";

values[0].size=2;

values[1].name="Lulu";

values[1].color="Black";

values[1].size=3;

values[2].name="Garth";

values[2].color="white";

values[2].size=4;

cout << "What cat do you want to know about?" << endl;

cin>>choice;

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

The Manga Guide To Databases

Authors: Mana Takahashi, Shoko Azuma, Co Ltd Trend

1st Edition

1593271905, 978-1593271909

More Books

Students also viewed these Databases questions