Use app×
Join Bloom Tuition
One on One Online Tuition
JEE MAIN 2026 Crash Course
NEET 2026 Crash Course
CLASS 12 FOUNDATION COURSE
CLASS 10 FOUNDATION COURSE
CLASS 9 FOUNDATION COURSE
CLASS 8 FOUNDATION COURSE
0 votes
3.7k views
in Computer by (64.2k points)

Define a class Play in C++ with the following specifications: private members of class Play.

Playcode integer
PlayTitle 25 character
Duration  float
Noofscenes integer

public member function of class Play

A constructor function to initialise Duration as 45 and Noofscence as 5.
Newplay() unction to accept values for Playcode and PlayTitle. 
Moreinfo() function to assign the values of Duration and Noofscenes with the help of corresponding values passed as parameters to this function.
Showplay() function to display all the data member on the screen. 

1 Answer

+1 vote
by (69.5k points)
selected by
 
Best answer

Class play

{ int Playcode;

char Playtitle[25];

float Duration;

int Noofscenes;

public:

Play()

{

Duration=45.0;

Noofscenes=5;

}

 void Newplay()

{ cout<<"enter playcode: ";

cin>>Playcode;

cout<<"enter playtitle: ";

gets(Playtitle);

}

void Moreinfo(float d,int n)

{

Duration=d;Noofscenes=n;

}

void Showplay()

{

cout<<"Playcode: "<<Playcode<<endl;

cout<<"Playtitle: "<<Playtitle<<endl;

cout<<"Duration: "<<Duration<<endl;

cout<<"Noofscenes: "<<Noofscenes<<endl;

}

};

Welcome to Sarthaks eConnect: A unique platform where students can interact with teachers/experts/students to get solutions to their queries. Students (upto class 10+2) preparing for All Government Exams, CBSE Board Exam, ICSE Board Exam, State Board Exam, JEE (Mains+Advance) and NEET can ask questions from any subject and get quick answers by subject teachers/ experts/mentors/students.

Categories

...