Word Game : Write a C++ program that plays a word game with the user. The progra
ID: 647760 • Letter: W
Question
Word Game : Write a C++ program that plays a word game with the user. The program should ask the user to enter the following
- Name
- Age
- The name of the City
- The name of the College
- A profession
- A type of an animal
- A pet
Explanation / Answer
#include<iostrem>
#include<string>
#include<stdio.h>
class test
{
cahr eame[20];
int age;
char city[20];
char college[20];
char proffession[20];
char animal[20];
char petname[20];
public :
void detailsRead();
void showpara();
};
void detailsRead()
{
cout<<"Enter Name of Person: ";
cin<<name;
cout<<"Enter Age of Person";
cin<<age;
cout<<"Enter City";
cin<<city;
cout<<"Enter College of Person";
cin<<college;
cout<<"Enter person Proffsion";
cin<<proffessiion;
cout<<"Enter type of animal";
cin<animal;
cout<<"Enter petname":
cin<<petname;
}
void showdetails()
{
cout<<"Tere Once was a person named "<<name << "Who lived in" << city << ".At the age of" << age << name <<"went to college at"<<college. << name << "graduted and went to work as a " << proffession <<".Then" << name << "adopted a(n) " << animal <<" named" << petname <<" They both lived happily ever after.". <<endl
}
int main()
{
test t1;
t1.detailsRead();
t1.showpara();
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.