Answer to Question #202660 in C++ for Syasya

Question #202660

Prepare a structure to store information on cat info (name , age , type). Create an array structured variable named CatInfo to received 2 inputs from user.


1
Expert's answer
2021-06-03T06:29:56-0400
using namespace std;


//Prepare a structure to store information on cat info (name , age , type). 
//Create an array structured variable named CatInfo to received 2 inputs from user.


#define ARRAY_SIZE	2
struct Cat
{
	string Name;
	string Type;
	int Age;	
};


main(void)
{
	struct Cat CatInfo[ARRAY_SIZE];
	int n;
	
	for(n=0;n<ARRAY_SIZE;n++)
	{
		cout<<"\n\nEnter Cat-"<<n+1;
		cout<<"\nEnter Name: "; cin>>CatInfo[n].Name;
		cout<<"\nEnter Type: "; cin>>CatInfo[n].Type;
		cout<<"\nEnter Age : "; cin>>CatInfo[n].Age;
	}
	
	cout<<"\n\nCat's Infoamation as entered:";
	cout<<"\n\tName\t\tType\t\tAge";
	for(n=0;n<ARRAY_SIZE;n++)
	{
		cout<<"\n\t"<<CatInfo[n].Name<<"\t\t"<<CatInfo[n].Type<<"\t\t"<<CatInfo[n].Age;
	}
	return(0);
}




Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog