Portfolio Title





 

 

Student Portfolio >> Index >> Coding >> Exercise 15

#include <iostream.h>
           int main()
           {
           int score, i, A = 0, B=0, C=0, fails=0, numa=0, numb=0, numc=0, numfail=0, avea=0, aveb=0, avec=0, 
               avefail=0;
           for(i=1; i<=10; i=i++)           
{ 
   cout << "Enter Score Number " << i << ":";
   cin >> score;
   if (score >=75)
   { 
   numa++;
   A= A + score;
   avea = A/numa;
   }
   else if(score >=65)
   {
   numb++;
   B= B + score;
   aveb = B/numb;
   }
   else if (score >=50)
   { 
   numc++;
   C= C + score;
   avec = C/numc;
   }
   else if
   { 
   numfail++;
   fails = fails + score;
   avefail = fails/numfail; 
   }
}
   cout << "Their was " << numa << " A's and the average score of the A's is "<< avea << "\n";
   cout << "Their was " << numb << " B's and the average score of the B's is "<< aveb << "\n";
   cout << "Their was " << n
   cout << "Their was " << numa << " A's and the average score of the A's is "<< avea << "\n";
   cout << "Their was " << numb << " B's and the average score of the B's is "<< aveb << "\n";
   cout << "Their was " << numc << " C's and the average score of the C's is "<< avec << "\n";
   cout << "Their was " << numfail << " fails at an average of " << avefail << "\n";
   return 0;


<< Back                                                                                                                                                                                      Forward >>

Coding | Website Scripting | Visual Design | Instructional Design | Website Design | Website Design Tools

 

Copyright 2005 Kerstin Kegel