Can't get a math equation to work. Help :)

#include <iostream>
#include <stdlib.h>

using namespace std;

int main ()
{
int midterm;
int final;
int researchPaper;
int groupProject;
int participation;

cout << "Enter grade, in points, for Midterm out 250 points: ";
cin >> midterm;

cout << "Enter grade, in points, for final out of 250 points: ";
cin >> final;

cout << "Enter grade, in points, for Research Paper out of 150 points: ";
cin >> researchPaper;

cout << "Enter grade, in points, for Group Project out of 150 points: ";
cin >> groupProject;

cout << "Enter grade, in points, for participation out of 50 points: ";
cin >> participation;

float midterm2 = (midterm/250)*.25;
float final2 = (final/250)*.25;
float groupProject2 = (groupProject/150)*.20;
float researchPaper2 = (researchPaper/250)*.20;
float participation2 = (participation/50)*.10;

float classgrade = (midterm2 + final2 + groupProject2 + researchPaper2 + participation) * 100;


cout << "Your class grade: " << classgrade << "%" << endl;

system("PAUSE");

return 0;
}

When I put input numbers to come out as 76%; I get 5000%. Obviously something is wrong haha.
The way I read it, you should be getting 0%. So I'm missing something on first reading.

The first thing you need to do is get rid of the integer division. change (midterm/250) to ((float)midterm/250). Do that for all of your grade components.

See where that gets you.
Oh. you added participation into your final instead of participation2. You probably entered '50' for participation, and (50 * 100) = 5000.
That's getting closer. I replaced them with the Floats, and I also replaced participation with participation2(good eye). For some reason, its still not completely accurate, mathematically. I'm getting 46% when I input 50% assignments, and at the 76% mark, I'm getting 71%.
Found it. I had researchPaper2 = researchPaper/250 rather than 150.
Topic archived. No new replies allowed.