Im writing a program and need help with the beginning, where after taking a number imput IE. How many tests are being averaged, the user can input that number of test scores as another 4 variables to be used later.
So far I have..
#include <iostream>
#include <cmath>
#include <cassert>
#include <cctype>
#include <conio.h>
usingnamespace std;
double equation1 (double r, double h);
// main running program
int main()
{
//Listing variable values
double numberofscores
// Getting number of test scores
cout<< "So how many test scores do you have? " <<endl;
cin>> numberofscores;
// Reading that # of test scores
getch();
First of all, it should be int numberofscores; since there won't be 3.5 test scores. And what do you mean "to be used later"? If all you're doing is averaging test scores, then you just need to compute the sum of the scores. Here are the steps you should take:
1 2 3 4 5 6 7
//Reading that # of test scores
//1. Initialize the sum of test scores to zero (make this a double)
//2. In a loop, ask the user for the current score and add that to the sum
//3. Compute the average of the test scores and display it.