From 7cce7c24669a5f0c8f9d2f4271f9587a13b97a65 Mon Sep 17 00:00:00 2001 From: Ashwani Kumar <53987093+ashwani8958@users.noreply.github.com> Date: Fri, 15 May 2020 13:33:21 +0530 Subject: [PATCH] Please see the modified code I just added the code so that it can work if number of player is more then five. --- Exercise_3/3.6_Table.cpp | 32 ++++++++++++++++++++++++++------ 1 file changed, 26 insertions(+), 6 deletions(-) diff --git a/Exercise_3/3.6_Table.cpp b/Exercise_3/3.6_Table.cpp index baa9a11..0108fe4 100644 --- a/Exercise_3/3.6_Table.cpp +++ b/Exercise_3/3.6_Table.cpp @@ -1,16 +1,31 @@ #include #include +//Added +#include + int main() { - int i,players,runs[5],inn[5],notout[5],average[5]; + int i,players + + //Modified + int *runs, *inn, *notout + float *average; + char name[20][5]; clrscr(); - cout<<"Enter number of players(no more than 5): "; + cout<<"Enter number of players(can be more then 5): "; cin>>players; + + //Modified + run = new int[players]; + inn = new int[players]; + notout = new int[players]; + average = new int[players]; + for(i=1;i<=players;i++) { - cout<<"Input details of player no. "<>name[i]; cout<<"No. of runs made: "; @@ -24,11 +39,16 @@ int main() { average[i]=runs[i]/inn[i]; } - cout<<"\nName\tRuns\tInnings\tTimes not out\tAverage"<