Take percentage of each input as it is being input

Hello, here is my version of Pseudocode for what I am trying to do, which I believe is quite simple however I cannot find the exact syntax for what I want.

When I run my program, I get a result of 86 when I should get a result of 86.25.
I would appreciate feedback on how I can write more efficient code that will calculate the percentage for each variable as it is input by the user and then total up these 4 values. Or if there are any other mistakes in the syntax.

Input: Test1 score, Test2 score, Final score, Assignments
Output: The student's total score (float with 2 decimals)

Pseudocode:
Declare a variable for each score and variable for the total score
Input each score one by one
Multiply the value of each score variable by their corresponding percentages
Take the value of each variable (after being multiplied by their corresponding percentages) and add them up for the value of the variable for total score

Total score = (15% of Test 1 score) + (15% of Test score 2) + (40% of Final score) + (30% of assignments score)
Test score 1 = Input of Test score 1 multiplied by .15
Test score 2= Input of Test score 2 multiplied by .15
Final score = Input of Final score multiplied by .40
Assignments score = Input of assignments score multiplied by .30

Code I have so far:

#include <iostream>
using namespace std;
int main()
{
int test1_score, test2_score, final_score, assign_score;
float total_score;

cout << "Enter your Test 1 score, Test2 score, Final score, and Assignments score." << endl;

cin >> test1_score;//read in Test 1 score
cin >> test2_score;//read in Test2 score
cin >> final_score;//read in Final score
cin >> assign_score;//read in Assignments score

test1_score = test1_score * 0.15;//multiply the value of test1_score by 0.15
test2_score = test2_score * 0.15;//multiply the value of test2_score by 0.15
final_score = final_score * 0.40;//multiply the value of final_score by 0.40
assign_score = assign_score * 0.30;//multiply the value of assign_score by 0.30

cout.setf(ios::fixed);
cout.setf(ios::showpoint);
cout.precision(2);

total_score = test1_score + test2_score + final_score + assign_score;

cout << "Your Total score is: " << float (total_score) << endl;

return 0;
}
Use float or double instead of int
Topic archived. No new replies allowed.