Ask Question

Name:
Title:
Your Question:

Answer Question

Name:
Your Answer:
User Submitted Source Code!


Description:
  average calculator
Language: C/C++
Code:
#include <iostream>

using namespace std;

int main()
{
float a,b,c,d,e,f,g,h,i,j;

cout << "Enter the number of voters with each score (separated by spaces):\n";
cin >> a >> b >> c >> d >> e >> f >> g >> h >> i >> j;
cout << "Average: " << (a + b*2 + c*3 + d*4 + e*5 + f*6 + g*7 + h*8 + i*9 + j*10) / (a+b+c+d+e+f+g+h+i+j) << endl;
cout << "Number of voters: " << (a+b+c+d+e+f+g+h+i+j);
}
Comments: