Home › Forums › C Programming › Please help me~!! i dunno do › Reply To: Please help me~!! i dunno do
November 11, 2006 at 5:29 am
#3210
Anonymous
Inactive
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 | #include <br /> #include <br /> DEFINE CLASS_SIZE 4<br /> void main()<br /> {<br /> /*Local Declaration*/<br /> char gradeAACS1084[CLASS_SIZE],gradeAACS1123[CLASS_SIZE];<br /> float scoreAACS1084[CLASS_SIZE],scoreAACS1123[CLASS_SIZE] ;<br /> float solutionGPA[CLASS_SIZE],totalsolutionGPA=0.000;<br /> float lowestGPA=4.000,highestGPA=0.000;<br /> int highGPAstudent,lowGPAstudent;<br /> /*============================== get input grade ==============================*/<br /> for(a=1;a<=CLASS_SIZE;a++){<br /> printf("Please Input the score for >n");<br /> for(a=1;a<=CLASS_SIZE;a++){<br /> printf("nStudent %dnn",a);<br /> printf("AACS1084( Programming Concepts & Design II ): ");<br /> scanf("%c",&gradeAACS1084[a]);<br /> printf("nn");<br /> printf("AACS1123( Principles of Information Systems ): ");<br /> scanf("%c",&gradeAACS1123[a]);<br /> printf("nn");<br /> }//Get Grade<br /> /*============================== Convert PCD2 Score ==============================*/<br /> for(a=1;a<=CLASS_SIZE;a++){<br /> if(toupper(gradeAACS1084[a])=='A')<br /> scoreAACS1084[CLASS_SIZE]=4.000;<br /> else if(toupper(gradeAACS1084[a])=='B')<br /> scoreAACS1084[CLASS_SIZE]=3.000;<br /> else if(toupper(gradeAACS1084[a])=='C')<br /> <br /> scoreAACS1084[CLASS_SIZE]=2.000;<br /> else if(toupper(gradeAACS1084[a])=='D')<br /> <br /> scoreAACS1084[CLASS_SIZE]=1.000;<br /> else if(toupper(gradeAACS1084[a])=='E')<br /> <br /> scoreAACS1084[CLASS_SIZE]=0.000;<br /> else if(toupper(gradeAACS1084[a])=='F')<br /> <br /> scoreAACS1084[CLASS_SIZE]=0.000;<br /> /*============================== Convert PIS Score ==============================*/<br /> if(toupper(gradeAACS1123[a])=='A')<br /> <br /> scoreAACS1123[CLASS_SIZE]=4.000;<br /> else if(toupper(gradeAACS1123[a])=='B')<br /> <br /> scoreAACS1084[CLASS_SIZE]=3.000;<br /> else if(toupper(gradeAACS1123[a])=='C')<br /> <br /> scoreAACS1123[CLASS_SIZE]=2.000;<br /> else if(toupper(gradeAACS1123[a])=='D')<br /> <br /> scoreAACS1123[CLASS_SIZE]=1.000;<br /> else if(toupper(gradeAACS1123[a])=='E')<br /> <br /> scoreAACS1123[CLASS_SIZE]=0.000;<br /> else if(toupper(gradeAACS1123[a])=='F')<br /> <br /> scoreAACS1123[CLASS_SIZE]=0.000;<br /> <br /> /*============================== Calculate GPA ==============================*/<br /> solutionGPA[CLASS_SIZE]=(scoreAACS1084[CLASS_SIZE]+scoreAACS1123[CLASS_SIZE]/(3.000+4.000);<br /> <br /> totalsolutionGPA+=solutionGPA[CLASS_SIZE];<br /> <br /> if(solutionGPA[CLASS_SIZE]<lowestGPA){<br /> lowestGPA=solutionGPA[CLASS_SIZE];<br /> lowGPAstudent=a;<br /> }//determine lowest GPA student<br /> <br /> if(solutionGPA[CLASS_SIZE]>highestGPA){<br /> highestGPA=solutionGPA[CLASS_SIZE];<br /> highGPAstudent=a;<br /> }//determine highest GPA student<br /> }//end for loop(from get input grade)<br /> //Calculate average total GPA<br /> averagetotalGPA=totalsoltionGPA/CLASS_SIZE;<br /> /*============================== Display output ==============================*/<br /> printf("nttExamination Resultn");<br /> printf("Student No.tAACS1084ttAACS1123ttGrade Point Averagen");<br /> printf("===========t========tt========tt=== ================n");<br /> <br /> for(a=1;a<=CLASS_SIZE;a++){<br /> printf("%dtt%ctt%ctt%ct%ctt%.3fn",a,gr adeAACS1084[a],gradeAACS1123[a],solutionGPA[CLASS_SIZE]);<br /> }<br /> <br /> printf("nnAVERAGE GPA = %dn",averagetotalGPA);<br /> printf("nnHIGHEST GPA = %.3ft obtained by Student No. %d",);<br /> printf("nnLOWEST GPA = %.3ft obtained by Student No. %d",lowestGPA,lowGPAstudent);<br /> |