Taking Input from a variable

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..

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#include <iostream>
#include <cmath>
#include <cassert>
 #include <cctype>
 #include <conio.h>
 using namespace 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();


Any tips or ideas?
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. 

For using loops, check this out: http://www.cplusplus.com/doc/tutorial/control/
Well im asking the user how many tests they want averaged, and then reading in that many test scores.
Right, so you wouldn't have to store them for later. As you read a score, you can simply add it to the sum and discard it.
Topic archived. No new replies allowed.