Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

ZYBOOKS HELP. Please advise why I am getting this error in my code and help me fix the code: Program generated too much output. Output

ZYBOOKS HELP.

Please advise why I am getting this error in my code and help me fix the code: Program generated too much output. Output restricted to 50000 characters. Check program for any unterminated loops generating output.

#include

int main() { int jerseyNumber[5]; int rating[5]; int num,rate; int flag=0; char choice='o'; for(int i=0;i<5;i++){ printf(" Enter player %d's jersey number: ",(i+1)); scanf("%d",&num); printf("Enter player %d's rating: ",(i+1)); scanf("%d",&rate); while((num<0 || num>99) || (rate<1 || rate>9)){ printf("Wrong value entered!! Please enter jerseyNumber between 0-99 and rating between 1-9."); if(num<0 || num>99){ printf(" Enter player %d's jersey number: ",(i+1)); scanf("%d",&num); } if(rating[i]<1 || rating[i]>9){ printf("Enter player %d's rating: ",(i+1)); scanf("%d",&rate); } } jerseyNumber[i]=num; rating[i]=rate; } printf(" ROSTER"); for(int i=0; i<5;i++){ printf(" Player %d -- Jersey number: %d, Rating: %d",(i+1),jerseyNumber[i],rating[i]); } int countRoster=5; while(choice!='q'){ printf(" MENU u - Update player rating a - Output players above a rating r - Replace Player o - Output roster q - Quit Choose an option : "); getchar(); choice=getchar(); if(choice=='a'){ int ratings; printf("Enter a rating: "); scanf("%d",&ratings); int fl=0,index=1; printf("Above %d",ratings); for(int i=0;i9)) { printf("Please enter rating between 1 to 9!!Enter a new rating for player: "); scanf("%d",&newrating); } rating[i]=newrating; fl=1; break; } } if(fl==0){ printf("Invalid jersey number"); } else{ printf("Updated rating."); } } else if(choice=='o'){ printf(" ROSTER"); for(int i=0; i<5;i++){ printf(" Player %d -- Jersey number: %d, Rating: %d",(i+1),jerseyNumber[i],rating[i]); } } else if(choice=='r'){ int jno; printf("Enter a jersey number: "); scanf("%d",&jno); int fl=0,newjno,newrating; for(int i=0;i99) || (newrating<1 || newrating>9)){ if(newjno<0 || newjno>99){ printf("Jersey number should be between 0 to 99.Enter a new jersey number: "); scanf("%d",&newjno); } if(newrating<1 || newrating>9){ printf("Rating should be between 1 to 9.Enter a rating for the newplayer: "); scanf("%d",&newrating); } } jerseyNumber[i]=newjno; rating[i]=newrating; fl=1; break; } } if(fl==0){ printf("Invalid jersey number"); } else{ printf("Updated player."); }

} else if(choice=='q' ){ printf("Quiting program."); } else{ printf("Wrong choice entered."); }

}

return 0; }

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

7. Understand the challenges of multilingualism.

Answered: 1 week ago