| | |
Averaging and grading program in C
Please support our C advertiser: Programming Forums - DaniWeb Sister Site
Thread Solved |
>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.
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.
•
•
Join Date: May 2007
Posts: 24
Reputation:
Solved Threads: 0
/*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 );
{
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 );
•
•
Join Date: May 2007
Posts: 24
Reputation:
Solved Threads: 0
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 );
}
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 );
}
![]() |
Other Threads in the C Forum
- Previous Thread: Class help needed
- Next Thread: Initialising Video Modes
| Thread Tools | Search this Thread |
#include adobe api array arrays asterisks binarysearch calculate char cm copyanyfile copyimagefile copypdffile cprogramme createcopyoffile createprocess() csyntax directory dynamic feet fflush fgets file fork forloop framework frequency getlasterror givemetehcodez global graphics gtkgcurlcompiling hacking hardware highest homework i/o incrementoperators initialization kernel kilometer km linked linkedlist linux linuxsegmentationfault list lists locate logical_drives loopinsideloop. match matrix meter microsoft motherboard mqqueue multi mysql number odf open opensource owf pattern pdf performance pointer pointers posix probleminc process program programming pyramidusingturboccodes read recursion recv repetition research scanf scheduling scripting segmentationfault send shape socket socketprograming stack standard string strings systemcall testautomation unix user voidmain() wab win32api windows.h






