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
+2 votes
8.3k views
in Computer by (64.1k points)

Write a program to print the score board of a cricket match in real time. The display should contain the batsman’s name, runs scored, indication if out, mode by which out, bowler’s score (overs played, maiden overs, runs given, wickets taken). As and when a ball is thrown, the score should be updated. (Hint: Use separate arrays to store batsmen’s and bowlers’ information)

by (10 points)
Plz say me the out put sir

1 Answer

+3 votes
by (69.4k points)
selected by
 
Best answer

#include<iostream.h>

#include<conio.h>

#include<stdio.h>

class batsman

{

public:

char name[20];

int run_score,indi_out;

char modeout[20];

void getdata()

{

cout<<".....Enter information for batsman......."<<end1;

cout<<"Enter batsman's name: ";

gets(name);

cout<<"Enter runs scored: ";

cin>>run_score;

cout<<"Enter 0 if NOT-OUT or 1 if OUT: "; cin>>indi_out;

if(indi_out==1)

{

cout<<"Enter mode by which out: ";

gets(modeout);

}

}

void putdata()

{

cout<<"......Batsman's Information........."<<end1;

cout<<"Batsman's name: "<<name<<end1;

cout<<"Runs scored: "<<run_score<<endl;

if(indi_out==1)

{

cout<<"OUT: "<<"Yes"<<end1;

cout<<"Mode by which out: "<<modeout<<end1;

}

}

void update()

{

int new_run;

cout<<".....Enter update for batsman....."<<end1;

cout<<"Enter new run: ";

cin>>new_run;

putdata();

run_score=run_score+new_run;

cout<<"Updated run: "<<run_score;

}

};

class bowler

{

public:

char bname[20];

int over_play,maiden_over,run_given,wicket;

void getinfo()

{

cout<<".....Enter information for bolwer......."<<endl;

cout<<"Enter bowler's name: ";

gets(bname);

cout<<"Enter overs played: ";

cin>>over_play;

cout<<"Enter maiden overs: ";

cin>>maiden_over; cout<<"Enter runs given: "; 

cin>>run_given; cout<<"Enter wicket taken: "; 

cin>>wicket;

}

void disp_info()

{

cout<<"......Bowler's Information........."<<end1;

cout<<"Bolwer's name: "<<bname<<end1;

cout<<"Overs played: "<<over_play<<end1;

cout<<"Maiden overs: "<<maiden_over<<end1;

cout<<"Runs given: "<<run_given<<end1;

cout<<"Wicket taken: "<<wicket<<end1;

}

};

void main()

{

clrscr();

int ch;

batsman b1;

bowler b2;

b1.getdata();

b2.getinfo();

b1.putdata();

b2.disp_info();

cout<<"Is ball thrown..?? (1-Yes or 0-NO) ";

cin>>ch;

if(ch==1)

{

b1.update();

b2.upd();

}

clrscr();

}

by (10 points)
Out put for this

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

...