hi i have a question. in my structure i have "int scored". i will ONLY be using this so that the user can input the scores between the two teams after a football match. so the thing is is that i dont want the "scored" to constantly increase after every game. for example. chelsea 2 arsenal 3 and then chelsea 1 liverpool 2. see that? chelsea scored 2 goals in the first game and then 1 against liverpool. but i dont want those 2 goals to be transfered to the next game so that chelsea have 2+1 goals to make 3 which in turn would mean chelsea beat liverpool 3 goals to 2. so is there a way of flushing out the score or setting it back to zero after every time the user enters the scores of each game? here is my code to help you understand more. the part in this code i am referring to is the last "for" loop.
Code:
#include <stdio.h>
#include <stdlib.h>
struct bones
{
char name[20];
int played;
int scored;
int won;
int drawn;
int lost;
int points;
};
struct bones team[4];
int main()
{
int i;
for(i=0;i<4;i++)
{
team[i].played = 0;
team[i].won = 0;
team[i].scored = 0;
team[i].lost = 0;
team[i].drawn = 0;
team[i].points = 0;
}
for(i=0;i<4;i++)
{
printf("enter each team name\n");
fgets(team[i].name, 20, stdin);
}
for(i=1;i<4;i++)
{
printf("%s vs %s\n",team[0].name,team[i].name);
printf("%s's score:\n",team[0].name);
scanf("%d",team[0].scored);
printf("%s's score:\n",team[i].name);
scanf("%d",team[i].scored);
}
return(0);
}