Help with pointers

Hi my program is meant to calculate the average of however many test scores the user decides to input but before that, I am supposed to print out a chart of the test scores that were entered. I have gone through my book many times and I can't seem to figure out what to put in the next print/cout function when using a pointer. This is just a snippet of my code however if all of it is needed let me know.

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
  	cout << "How many tests do you wish to process? ";
    	cin >> tests;
    	
    	while (tests < 0)
    	{
        	cout << "Enter a valid number of tests:  ";
        	cin >> tests;
    	}
    	scores = new double[tests];

    	cout << "Enter the test scores below: \n";
    	for (count = 0; count < tests; count++)
    	{
    		cout << "Test " << (count + 1) << ": ";
    		cin >> *(scores + count);
        
       		while (*(scores + count) < 0)
        	{
            	cout << "Please enter a valid test score. \n";
            	cin >> *(scores + count);
        	}
    	}
		
		cout << setw(15) << "Grade:" << endl;
		cout << setw(15) << "-------" << endl;
to print out what was input (you can add to it, this is the bare bones)

for (count = 0; count < tests; count++)
cout << scores[count] << endl;

also math and * notation can get weird, I prefer [] notation as above esp if you ever need to multiply anything.


Registered users can post here. Sign in or register to post.