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;

cin>> HW1;

cin>> HW2;

cin>> HW3;

cin>> HW4;

cin>> HW5;

cin>> HW6;

cin>> HW7;

cin>> HW8;

cin>> HW9;

cin>> HW10;

cin>> LG1;

cin>> LG2;

cin>> LG3;

cin>> LG4;

cin>> MTPC;

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;
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';

system("pause");
return 0;
}``````
2
Contributors
1
2
Views
7 Years
Discussion Span
Last Post by Lerner

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 topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.