| | |
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 * append array arrays asterisks bash binarysearch calculate changingto char character cm copyimagefile creafecopyofanytypeoffileinc createprocess() database dynamic execv feet fgets file floatingpointvalidation fork forloop framework function getlogicaldrivestrin givemetehcodez global grade gtkwinlinux hacking histogram ide include incrementoperators input intmain() iso kernel keyboard kilometer km license linked linkedlist linux list lists locate logical_drives looping loopinsideloop. lowest matrix meter microsoft mqqueue number oddnumber odf opensource openwebfoundation overwrite owf pdf performance pointer posix probleminc process program programming radix recursion recv recvblocked research reversing scripting segmentationfault sequential single socket socketprogramming standard strchr string systemcall testing threads turboc unix urboc user variable wab whythiscodecausesegmentationfault windowsapi






