I have written a program designed to show grades in a table form, however my first input isn't working ie, if a enter for the first input 55.5 9, the output does not match this, i really have no idea why, any assistance would be greatly appreciated

#include <iostream>
#include <iomanip>
using namespace std;

int main ()

{
    
    double weight1 = 0, weight2 = 0, weight3 = 0, weight4 = 0, weight5 = 0, weight6 = 0;
    double assignment1 = 0, assignment2 = 0, assignment3 = 0, assignment4 = 0, journal = 0, labwork = 0;
    float result1 = 0, result2 = 0, result3 = 0, result4 = 0, result5 = 0, result6 = 0;
    double totalweight = 0, totalresult = 0;
    
    cout << " Welcome to CSCI114 Assessment System " << endl;

    cout << " Enter mark for Assignment 1 and weight: ";
    cin >> assignment1;
    cin >> weight1;

    cout << "Enter mark for Assignment 2 and weight: ";
    cin >> assignment2;
    cin >> weight2;


    cout << " Enter mark for Assignment 3 and weight: ";
    cin >> assignment3;
    cin >> weight3;
    
    cout << " Enter mark for Assignment 4 and weight: ";
    cin >> assignment4;
    cin >> weight4;


    cout << " Enter mark for Journal and weight: ";
    cin >> journal;
    cin >> weight5;

    cout << " Enter mark for Labwork and weight: ";
    cin >> labwork;
    cin >> weight1;

    cout << "\n\n\n";
    
    result1 = (assignment1 / 100 * weight1);
    result2 = (assignment2 / 100 * weight2);
    result3 = (assignment3 / 100 * weight3);
    result4 = (assignment4 / 100 * weight4);
    result5 = (journal / 100 * weight5);
    result6 = (labwork / 100 * weight6);

    totalweight = (weight1 + weight2 + weight3 + weight4 + weight5 + weight6);
    
    totalresult = (result1 + result2 + result3 + result4 + result5 + result6);
    
    cout << fixed << showpoint;
    
    cout << " Components\t Marks\t Weight\t Results\n";
    cout << setfill ('=') << setw(60) << " " << endl << setfill (' ');
    
    cout << "Assignment 1" <<  setw (9) << setprecision (2) << assignment1 << setw (8) << setprecision (2) 
        << weight1 << setw (16) << setprecision (2) << result1 << endl;
    
    cout << "Assignment 2" <<  setw (9) << setprecision (2) << assignment2 << setw (8) << setprecision (2) 
        << weight2 << setw (16) << setprecision (2) << result2 << endl;
    
    cout << "Assignment 3" <<  setw (9) << setprecision (2) << assignment3 << setw (8) << setprecision (2) 
        << weight3 << setw (16) << setprecision (2) << result3 << endl;
    
    cout << "Assignment 4" <<  setw (9) << setprecision (2) << assignment4 << setw (8) << setprecision (2) 
        << weight4 << setw (16) << setprecision (2) << result4 << endl;
    
    cout << "Journal" <<  setw (14) << setprecision (2) << journal << setw (8) << setprecision (2) 
        << weight5 << setw (16) << setprecision (2) << result5 << endl;
    
    cout << "Labwork" <<  setw (14) << setprecision (2) << labwork << setw (8) << setprecision (2) 
        << weight6 << setw (16) << setprecision (2) << result6 << endl;
    
    cout << setfill ('=') << setw(60) << " " << endl << setfill (' ');
    
    cout << "Total" << setw (16) << "***" << setw (8) << setprecision (2) 
        << totalweight << setw (16) << setprecision (2) << totalresult << endl;
    
    cout << setfill ('-') << setw(60) << " " << endl << setfill (' ');    
    
    return 0;
}

You are assign value to 'weight1' two time.
Just Replace line no. 40

cout << " Enter mark for Labwork and weight: ";
    cin >> labwork;
    cin >> weight1; // Assign value to weight1, That is already assign at line no.18

With

cout << " Enter mark for Labwork and weight: ";
    cin >> labwork;
    cin >> weight6;

not sure if i should start a new post but i now have to add the use of cin.fail, i can get it to fail if i input a character, but cant seem to get it to fail when mark is > 100, is it possible for cin.fail to do that? or should i just add another statement that deals with marks > 100

This question has already been answered. Start a new discussion instead.