What's wrong with this program?

This is what I have for the following problem. It isn't right though and I don't know here to go from here.

"Write a program that allows you to input students' scores and weights. The program should then calculate a weighted average and score based on the data inputted by the user."


#include <iostream>

int main()
{
// define number of scores
const int NSCORES = 6 ;

// variables to hold the total weighted score and the total weight
double total_weighted_score = 0 ;
double total_weight = 0 ;

// accept 'NSCORES' score-weight pairs from the user,
// accumulate the total weighted score and the total weight as you go
int score ;
double weight ;
for( int i = 0 ; i < NSCORES ; ++i )
{
std::cout << "enter score and weight: " ;
std::cin >> score >> weight ;
// TO DO: validate that score and weight are within valid ranges
// if not, emit a message, and repeat the above two lines

const double weighted_score = score * weight ;
total_weighted_score += weighted_score ;
total_weight += weight ;
}

// TO DO: calculate weighted average (total_weighted_score divided by total_weight)
// and print it out
}
Topic archived. No new replies allowed.