Question: could you take a look and edit my code it keeps printing out random garbage #include #include #include #include #include int main(void) { char team[100][50];
could you take a look and edit my code it keeps printing out random garbage
#include
#include
#include
#include
#include
int main(void) {
char team[100][50];
char firstname[20];
char secname[20];
char lastname[10];
char print[22];
int points[100];
int z=0;
int y=0;
int x=0;
int max;
int gamewon[100];
int glostreg[22];
int glostover[100];
int glostshoot[100];
setvbuf(stdout,NULL,_IONBF,0);
printf("Enter team data:");
while(x
scanf("%s", firstname);
scanf("%s", secname);
scanf("%s", lastname);
strcat(firstname, " ");
strcpy(team[x], firstname);
strcat(secname, " ");
strcat(team[x], secname);
if (isalpha(lastname[0])) {
strcat(team[x], lastname);
scanf("%d", &gamewon[x]);
} else {
gamewon[x] = atoi(lastname);
}
scanf("%d %d %d", &glostreg[x], &glostover[x], &glostshoot[x]);
points[x]=(gamewon[x]*2)+(glostshoot[x]*1)+(glostover[x]*1);
x=x+1;
printf("Team W L OTL SOL PTS ");
for (x = 0; x
printf("%-25s %3.1d %3.1d %3.1d %3.1d %3.1d ", team[x], gamewon[x],
glostreg[x], glostover[x], glostshoot[x], points[x]);
}
printf(" ");
printf("Team W L OTL SOL PTS ");
//from the lecture slides//
for (x = 0; x
max = INT_MIN;
for (y = 0; y
if (!print[y] && points[y] > max) {
max = points[y];
z = y;
}
}
printf("%-25s %3.1d %3.1d %3.1d %3.1d %3.1d ", team[z], gamewon[z],
glostreg[z], glostover[z], glostshoot[z], points[z]);
print[z] = 1;
}
}
return EXIT_SUCCESS;
}
ITS SUPPOSED To DO THIS :

![team[100][50]; char firstname[20]; char secname[20]; char lastname[10]; char print[22]; int points[100]; int](https://dsd5zvtm8ll6.cloudfront.net/si.experts.images/questions/2024/09/66f39e575ac2f_81466f39e56d3e00.jpg)
4. prints a second table with the ordered by descending ts-iftwo teams have the same number of points they point should be in alphabetical order by team name (see sample output) Sample output Enter team data Brandon Wheat Kings 25 19 Calgary Hitmen 19 23 Edmonton Oil Kings 30 Everett silver ips 30
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
