Use app×
Join Bloom Tuition
One on One Online Tuition
JEE MAIN 2025 Foundation Course
NEET 2025 Foundation Course
CLASS 12 FOUNDATION COURSE
CLASS 10 FOUNDATION COURSE
CLASS 9 FOUNDATION COURSE
CLASS 8 FOUNDATION COURSE
0 votes
5.1k views
in Computer by (64.1k points)

Define a class to represent bowlers in a cricket team. Include the following members: Data Members: First name, Last name, Overs bowled, Number of Maiden overs, Runs given, Wickets taken. Member Functions:

(i) To assign the initial values,

(ii) To update the information,

(iii) To display the bowler’s information Make appropriate assumptions about access specifiers.

1 Answer

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

#include<iostream.h>

#include<conio.h>

#include<stdio.h>

class Bowlers

{

char F_Name[30];

char L_Name[30];

int Overs_bowled,Maiden_overs,Runs_given,Wickets; public:

void initial() {

cout<<end1<<"Enter first name : ";

gets(F-Name);

cout<<end1<<"Enter first name : ";

gets(L-Name);

cout<<Overs_bowled;

cout<<Overs_bowled;

cout<<end1<<"Enter first name : ";

cout<<end1<<"Enter how many overs maden : ";

cin>>Runs_given;

cout<<end1<<"Enter how many wickets taken : ";

cout<>Wickets;

}

void update ()

{

int

new_over_bolwed,new_maiden_overs,new_runs_given,new_wickets;

cout<<end1<<"Enter new overs bowled: ";

cin>>new_over_bolwed;

cout<<endl<<"Enter new madden overs: ";

cin>>new_maden_overs;

cout<<endl<<"Enter new runs given:  ";

cin>>new_runs_given;

cout<<endl<<"Enter new wickets taken: ";

cin>>new_wickets;

Overs_bowled=Overs_bowled+new_over_bolwed; Maiden_overs=Maiden_overs+new_maiden_overs;

Runs_given=Runs_given+new_runs_given; Wickets=Wickets+new_wickets;

display();

cout<<"Total overs bowled: "<<Overs_bowled<<end1;

cout<<"Total maidden overs: "<<Maiden_overs<<end1;

cout<<"Total runs given: "<<Runs_given<<end1;

cout<<"Total wickets taken: "<<Wickets<<end1;

}

void display(){

cout<<".....Bolwer's information....."<<end1;

cout<<"Name: "<<F_Name<<" "<<L_Name<<end1;

}

};

void main () {

clrscr();

Bowlers b1;

b1.initial();

b1.update();

getch();

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

...