Averaging and grading program in C

Please support our C advertiser: Programming Forums - DaniWeb Sister Site
Thread Solved

Join Date: May 2007
Posts: 24
Reputation: cyberman111 is an unknown quantity at this point 
Solved Threads: 0
cyberman111 cyberman111 is offline Offline
Newbie Poster

Re: Averaging and grading program in C

 
0
  #11
May 3rd, 2007
so why do u divede by 5 not 3
Reply With Quote Quick reply to this message  
Join Date: May 2007
Posts: 24
Reputation: cyberman111 is an unknown quantity at this point 
Solved Threads: 0
cyberman111 cyberman111 is offline Offline
Newbie Poster

Re: Averaging and grading program in C

 
0
  #12
May 3rd, 2007
also it is givin me the wrong output

i need to list the avg of all the students entered with a *** next to the ones with 95% or higher
Reply With Quote Quick reply to this message  
Join Date: Sep 2004
Posts: 7,728
Reputation: Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute 
Solved Threads: 737
Team Colleague
Narue's Avatar
Narue Narue is offline Offline
Code Goddess

Re: Averaging and grading program in C

 
0
  #13
May 3rd, 2007
Because there are five students. The first average taken inside of the loop is the average of a single student's three grades. The second average taken outside of the loop is the average of all five student's averages.
I'm here to prove you wrong.
Reply With Quote Quick reply to this message  
Join Date: Sep 2004
Posts: 7,728
Reputation: Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute 
Solved Threads: 737
Team Colleague
Narue's Avatar
Narue Narue is offline Offline
Code Goddess

Re: Averaging and grading program in C

 
0
  #14
May 3rd, 2007
>also it is givin me the wrong output
What's wrong about it?

>i need to list the avg of all the students entered with a *** next to the ones with 95% or higher
We haven't gotten to that part yet. You don't write everything in one swell foop, you write a little and test a little until all of the features are added and working properly.
I'm here to prove you wrong.
Reply With Quote Quick reply to this message  
Join Date: May 2007
Posts: 24
Reputation: cyberman111 is an unknown quantity at this point 
Solved Threads: 0
cyberman111 cyberman111 is offline Offline
Newbie Poster

Re: Averaging and grading program in C

 
0
  #15
May 3rd, 2007
/*for (x=0; x<2; x++)
{
if (st[x].id == 0)
break;
printf("\n %ld ", st[x].id);
printf("\t %s ", st[x].name);
printf("\t %.1f ", st[x].assignment); //print average instead and *** when >95
} */
double sum = 0;
for (x=0; x<2; x++)
{
double avg = ( st[x].assignment + st[x].quiz1 + st[x].quiz2 ) / 3;
if (st[x].id == 0)
break;
printf("\n %ld ", st[x].id);
printf("\t %s ", st[x].name);
printf("\t %.1f ", avg );
sum += avg;
}
printf ( "\nTotal average: %f\n", sum / 3 );
Reply With Quote Quick reply to this message  
Join Date: May 2007
Posts: 24
Reputation: cyberman111 is an unknown quantity at this point 
Solved Threads: 0
cyberman111 cyberman111 is offline Offline
Newbie Poster

Re: Averaging and grading program in C

 
0
  #16
May 3rd, 2007
hey it worked narue yo the man
i figur wat was wrong i had the tot # of student to 25 so i changed it all to 2 and it worked
now how do i place ** next to the ones with 95 %
Reply With Quote Quick reply to this message  
Join Date: May 2007
Posts: 24
Reputation: cyberman111 is an unknown quantity at this point 
Solved Threads: 0
cyberman111 cyberman111 is offline Offline
Newbie Poster

Re: Averaging and grading program in C

 
0
  #17
May 3rd, 2007
i relized it was just a simple mistake at teh begging of the code i had set it to 25 studetns but by the time i got to the bottom i just put in a random number of students

now i am done with that how do I add ***
would it be another if statement
such as

else if
Reply With Quote Quick reply to this message  
Join Date: May 2007
Posts: 24
Reputation: cyberman111 is an unknown quantity at this point 
Solved Threads: 0
cyberman111 cyberman111 is offline Offline
Newbie Poster

Re: Averaging and grading program in C

 
0
  #18
May 3rd, 2007
I DID ALL BYMYSELF LOL JK NARUE THANK YOU VERY MUCH YOUR GUIDENCE HELPED ALOT
LOOK AT THE OUTCOME
double sum = 0;
for (x=0; x<2; x++)
{
double avg = ( st[x].assignment + st[x].quiz1 + st[x].quiz2 ) / 3;
if (st[x].id == 0)
break;
printf("\n %ld ", st[x].id);
printf("\t %s ", st[x].name);
printf("\t %.1f ", avg );
if (avg > 95)
printf("*****");

sum += avg;
}
printf ( "\nTotal average: %f\n", sum / 3 );
}
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:



Other Threads in the C Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC