Code:

#include<stdlib.h>
#include<stdio.h>
void printStatement (float win[], float loss[], int pointsFor[], int pointsAgainst[]);
int main()
{
// Four teams, user number of weeks. Percentage wins, points for / against.
int weeks, homePoints, awayPoints, home, away, count, subCount, predict;
int pointsFor [4] = {0,0,0,0};
int pointsAgainst[4] = {0,0,0,0};
float win[4] = {0,0,0,0};
float loss[4] = {0,0,0,0};
int complexPointsHome =0;
int complexPointsAway =0;
printf("Enter the number of weeks: ");
scanf("%i", &weeks);
// Set up a loop for the number of weeks such that two games are played each week.
// If team 1 and 2 are playing teams 3 and 4 must play.
for (count =0; count < weeks; count++)
{
if (count = 2);
printStatement(win, loss, pointsFor, pointsAgainst);
for (subCount = 0; subCount < 2; subCount++)
{
predict =0;
if (count > 2)
{
printf("Would you like me to predict the winner? 0-NO, 1-YES: ");
scanf(" %i", &predict);
}
printf("\nEnter the Away team: ");
scanf("%i", &away);
printf("\nEnter the Home team: ");
scanf("%i", &home);
if (predict ==1)
{
printf("\n\t\tSimple Prediction\n");
if (win[home]>win[away])
printf("I predict Team %i will win!", home);
else if (win[home] < win[away])
printf("I predict Team %i will win!", away);
else printf("It's to close to tell!");
printf("\n\t\tComplex Prediction\n");
complexPointsHome++;
if (win[home]>win[away])
complexPointsHome++;
else if (win[home] < win[away])
complexPointsAway++;
if (pointsFor[home]>pointsFor[away])
complexPointsHome++;
else if(pointsFor[home]<pointsFor[away])
complexPointsAway++;
if (pointsAgainst[home]<pointsAgainst[away])
complexPointsHome++;
else if (pointsFor[home]<pointsFor[away])
complexPointsAway++;
if (win[home]>win[away])
printf("I predict Team %i will win!", home);
else if (win[home] < win[away])
printf("I predict Team %i will win!", away);
else printf("It's to close to tell!");
}
if (predict = 0);
{
printf("\nEnter the Home team's points: ");
scanf("%i", &homePoints);
pointsFor[home] =homePoints + pointsFor[home];
pointsAgainst[away] = homePoints +pointsAgainst[away];
printf("\nEnter the Away team's points: ");
scanf("%i", &awayPoints);
pointsAgainst[home] = awayPoints+pointsAgainst[home];
pointsFor[away] =awayPoints+pointsFor[away];
if (homePoints > awayPoints)
{
win[home]++;
loss[away]++;
}
else
{
win[away]++;
loss[home]++;
}
//repeat for second game, which will include the other two teams.
}
}
}
return 0;
}
void printStatement (float win[], float loss[], int pointsFor[], int pointsAgainst[]);
{
int weeks, pCount;
float percent[4] = {0,0,0,0};
weeks = (win[0]+loss[0], win[1]+loss[1], win[2]+loss[2], win[3]+loss[3])/4;
printf("\nThere are %i weeks so far.\n" , weeks);
for(pCount =0; pCount < 4; pCount++)
{
printf("Team %i wins %.0f losses %.0f\n", pCount, win[pCount], loss[pCount]);
if (win[pCount] == weeks)
percent[pCount] = 1;
else if (win[pCount] == 0)
percent[pCount] =0;
else percent[pCount] = win[pCount]/ weeks;
printf("percent %i = %.2f / %i = %.2f\n", pCount, win[pCount], weeks, percent[pCount]);
}
printf("\nLeague standings after %i weeks:\n", weeks);
printf("Team 0 %.0f - %.0f \n", win[0], loss[0]);
printf("Team 1 %.0f - %.0f \n", win[1], loss[1]);
printf("Team 2 %.0f - %.0f \n", win[2], loss[2]);
printf("Team 3 %.0f - %.0f \n", win[3], loss[3]);
printf("\nTeam 0 %i - %i \n", pointsFor[0], pointsAgainst[0]);
printf("Team 1 %i - %i \n", pointsFor[1], pointsAgainst[1]);
printf("Team 2 %i - %i \n", pointsFor[2], pointsAgainst[2]);
printf("Team 3 %i - %i \n", pointsFor[3], pointsAgainst[3]);
printf("\nTeam 0 %.0f%% \n", (percent[0]*100));
printf("Team 1 %.0f%%\n", (percent[1]*100));
printf("Team 2 %.0f%% \n", (percent[2]*100));
printf("Team 3 %.0f%%\n", (percent[3]*100));
}