Question: 1) In this question, write a function evaluate() and do the necessary evaluation. Question: To decide the final result of two football teams , following
1) In this question, write a function evaluate() and do the necessary evaluation.
Question: To decide the final result of two football teams , following data is taken from the monitor. First read the names of each team from the monitor and than get the goals of matches from the monitor until EOF.
Fenerbahce Galatasaray
2 1
.. ..
.. ..
EOF
To find the final scores, following process must be done for each match.
Using simple variable write a C program and function evaluate() and determine the final points of each team.
If the final points are same than check total number of goals of each team and identify and list the names and total points and total goals of both teams and identify the final winner as Better Team
Define your solution structure as follows.
void eval(int, int, int *, int *); // prototype
int main()
{
char namFb[12],nameGs[12];
int g1, g2, tg1 = 0,tg2 = 0, pt1 = 0,pt2 = 0;
scanf(%s%s ,nameFb, nameGs);
while(scanf(%d%d ,&g1,&g2) != EOF)
{
tg1+=g1;
tg2+=g2;
evaluate(g1 , g2 , &pt1, &pt2);
}
.
// Chech points and if total goals are equal or not
.
}
void eval()
{
..
}
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
