I'm still getting one error not sure why?

    Error 1 error C4700: uninitialized local variable 'arranged' used   74

Thanks.

#include <iostream>
#include <iomanip>
using namespace std;

//Function prototypes
void sortTestScores(int *TestScores, int size_Test);
double avgTestScore(int *TestScores, int size_Test);
void printTestScores(int *TestScores, int size_Test);
int main()
{
//Define variables
int *TestScores;
int size_Test, score;
double average;
//Get the number of test scores you want to average
cout << "How many test scores do you want to enter?";
cin >> size_Test;
//Dynamically allocate an array large enough to hold that many scores
TestScores = new int[size_Test];
//Get test scores
cout << "Enter " << size_Test << " positive test scores below:" << endl;
for (int i=0; i<size_Test; i++)
{
//Display score
cout << "Score " << i + 1 << ": "; 
cin >> score;
// Input validation. Only numbers between 0-100
while (score<0 || score>100)
{
cout << "You must enter a score that is positive" << endl;
cout << "Please enter again: ";
cin >> score;
}
TestScores[i]=score;
}
//Dsiplay the results
cout << "Test Scores: ";
printTestScores(TestScores, size_Test);
sortTestScores(TestScores, size_Test);
cout << "The test scores, sorted in ascending order, are: \n";
printTestScores(TestScores, size_Test);
average = avgTestScore(TestScores, size_Test);
cout << fixed << showpoint << setprecision(2);
cout << "The average of all the test scores is " << average << endl;
system ("pause");
return 0;
}
//Accepts a dynamic array of test scores and size of array, then sorts in ascending order
//Sort function implementation
void sortTestScores(int *TestScores, int size_Test)
{
int *last=TestScores+size_Test; //get last location of array
for (int *first = TestScores; first < last-1; first++)
{
    for(int *next=first+1; next<last; next++) 
    {
        if (*next<*first)
        {
        int temp=*first;
        *first=*next;
        *next=temp;
        }
    }
}
}
//calculates and returns average of test scores
double avgTestScores(double *TestScores, int size_Test)
{
int total = 0; 
double average;
int *arranged;
for (int i=0; i < size_Test; i++)
{
total+= *arranged;
arranged++;
}
average= double(total) / size_Test;
return average;
}
//Prints test scores stored in array
void printTestScores(int *TestScores, int size_Test)
{
int *arranged=TestScores;
for (int i=0; i < size_Test; i++)
{
cout << *arranged << " " << arranged << endl;
       arranged++; 
}
}

The error was clear, and in fact you did use it uninitialized. See line 71 up to 74? You shouldn't use this until you put something in there.

ok, I initialed it but I'm getting a different errors:

Error   2   error LNK1120: 1 unresolved externals       1
Error   1   error LNK2019: unresolved external symbol "double __cdecl avgTestScore(int *,int)" (?avgTestScore@@YANPAHH@Z) referenced in function _main  



#include <iostream>
#include <iomanip>
using namespace std;

//Function prototypes
void sortTestScores(int *TestScores, int size_Test);
double avgTestScore(int *TestScores, int size_Test);
void printTestScores(int *TestScores, int size_Test);

int main()
{
//Define variables
int *TestScores;
int size_Test, score;
double average;
//Get the number of test scores you want to average
cout << "How many test scores do you want to enter?";
cin >> size_Test;
//Dynamically allocate an array large enough to hold that many scores
TestScores = new int[size_Test];
//Get test scores
cout << "Enter " << size_Test << " positive test scores below:" << endl;
for (int i=0; i<size_Test; i++)
{
//Display score
cout << "Score " << i + 1 << ": "; 
cin >> score;
// Input validation. Only numbers between 0-100
while (score<0 || score>100)
{
cout << "You must enter a score that is positive" << endl;
cout << "Please enter again: ";
cin >> score;
}
TestScores[i]=score;
}
//Dsiplay the results
cout << "Test Scores: ";
printTestScores(TestScores, size_Test);
sortTestScores(TestScores, size_Test);
cout << "The test scores, sorted in ascending order, are: \n";
printTestScores(TestScores, size_Test);
average = avgTestScore(TestScores, size_Test);
cout << fixed << showpoint << setprecision(2);
cout << "The average of all the test scores is " << average << endl;
system ("pause");
return 0;
}
//Accepts a dynamic array of test scores and size of array, then sorts in ascending order
//Sort function implementation
void sortTestScores(int *TestScores, int size_Test)
{
int *last=TestScores+size_Test; //get last location of array
for (int *first = TestScores; first < last-1; first++)
{
    for(int *next=first+1; next<last; next++) 
    {
        if (*next<*first)
        {
        int temp=*first;
        *first=*next;
        *next=temp;
        }
    }
}
}
//calculates and returns average of test scores
double avgTestScores(int *TestScores, int size_Test)
{
int total = 0; 
double average;
int *arranged=TestScores;
for (int i=0; i < size_Test; i++)
{
total+= *arranged;
arranged++;
}
average= double(total) / size_Test;
return average;
}
//Prints test scores stored in array
void printTestScores(int *TestScores, int size_Test)
{
int *arranged=TestScores;
for (int i=0; i < size_Test; i++)
{
cout << *arranged << " " << arranged << endl;
       arranged++; 
}
}

I got it to output but I'm getting some random stuff after it prints out numbers:

Enter 6 positive test scores below:
Score 1: 89
Score 2: 94
Score 3: 100
Score 4: -78
You must enter a score that is positive
Please enter again: 78
Score 5: 84
Score 6: 65
Test Scores:
89 004BB260
94 004BB264
100 004BB268
78 004BB26C
84 004BB270
65 004BB274
The test scores, sorted in ascending order, are:
65 004BB260
78 004BB264
84 004BB268
89 004BB26C
94 004BB270
100 004BB274
The average of all the test scores is 85.00
Press any key to continue . . .

I didn't check for more of the same uninitialized variable use. You will check for that. Also, learn to print out variables so you can debug your code.

I got it actually, thanks though.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.