I need to modify my program to use while and for loops and be able to do the following tasks:
a. A score of I on the project forces a mid-term grade of I. Notify the user to contact both the student and their advisor of the I grade.
b. For each student mid-term grade calculated , notify the user of the mid-term grade and if any of the grade elements is below a 75% and what the grade element is.


Here is what Ive gotten thus far...

#include "stdafx.h"
#include <iostream>
#include <iomanip>
#include <math.h>

using namespace std;

int main(void)
{double HW1,HW2,HW3,HW4,HW5,HW6,HW7,HW8,HW9,HW10,HWT,LG1,LG2,LG3,LG4,LGT,MTP,MTPG,MTE,MTEG,sum,;
 char MTPC,letter;

 cout<<"Please enter homework grade 1 (1-5); ";
 cin>> HW1;

 cout<<"Please enter homework grade 2 (1-5); ";
 cin>> HW2;

 cout<<"Please enter homework grade 3 (1-5); ";
 cin>> HW3;

 cout<<"Please enter homework grade 4 (1-5); ";
 cin>> HW4;

 cout<<"Please enter homework grade 5 (1-5); ";
 cin>> HW5;

 cout<<"Please enter homework grade 6 (1-5); ";
 cin>> HW6;

 cout<<"Please enter homework grade 7 (1-5); ";
 cin>> HW7;

 cout<<"Please enter homework grade 8 (1-5); ";
 cin>> HW8;

 cout<<"Please enter homework grade 9 (1-5); ";
 cin>> HW9;

 cout<<"Please enter homework grade 10 (1-5); ";
 cin>> HW10;

 cout<<"Please enter lab grade 1 (1-10): ";
 cin>> LG1;

 cout<<"\nPlease enter lab grade 2 (1-10): ";
 cin>> LG2;

 cout<<"\nPlease enter lab grade 3 (1-10): ";
 cin>> LG3;

 cout<<"\nPlease enter lab grade 4 (1-10): ";
 cin>> LG4;

 cout<<"\nPlease enter Mid-term project letter grade (A-F): ";
 cin>> MTPC;

 cout<<"\nPlease enter Mid-term Exam grade (1-55): ";
 cin>> MTE;

	MTPC=toupper(MTPC); 
 if(MTPC=='A')
	 MTP=95;
 else if(MTPC=='B')
     MTP=85;
 else if(MTPC=='C')
	 MTP=75;
 else if(MTPC=='D')
	 MTP=65;
 else if(MTPC=='F')
	 MTP=55;
 else if(MTPC=='I')
	 MTP=50;
//equations for final grade
HWT=(HW1+HW2+HW3+HW4+HW5+HW6+HW7+HW8+HW9+HW10)/50.*.15*100;
LGT=(LG1+LG2+LG3+LG4)/40.*.35*100;
MTPG=MTP*.25;
MTEG=(MTE/55.)*.25*100;

 sum=HWT+LGT+MTPG+MTEG;
if(sum>95)  //if-else statements, determines final grade
    letter='A';
else if(sum>85)
    letter='B';
else if(sum>75)
      letter='C';
else if(sum>65)  
      letter='D';
else if(sum>55)
     letter='F';
else if(sum>50)
	 letter='I';
 cout<<"\nyour final grade is: "<<letter<<endl;
 
system("pause");
return 0;
}

loops and arrays (and other containers for that matter) are a match made in heaven. Put all the grades results in one or more array(s). Then use loops to do the calculations on lines 74, 75 and whereever else you need to.

This article has been dead for over six months. Start a new discussion instead.