Array problem. Unknown errors

Just think of me as a total noob. I have some errors that i don't understand and could really use some help.

#include <iostream>
#include <iomanip>


using namespace std;


void Array();

int main()
{

Array();

system("pause");
return 0;
}

void Array()
{
int nStud = 0, nMovs = 0;
int * ptr_1d;
int total = 0;
double average;
//allocates an array for the number of students
cout << "Enter the number of students surveyed: " << endl;
cin >> nStud;
while ( nStud < 0 )
{
cout << "Error! Please enter a positive number: ";
cin >> nStud;
}
//allocates an array for the number of movies for each student
ptr_1d = new int [nStud];
for ( int j = 0; j < nStud; j++ )
{
cout << "How many movies for student " << (j + 1) << ": ";
cin >> nMovs;
//Calculate total movies
total = total+nMovs;
while (nMovs < 0)
{
cout << "Error! Please enter a positive number: ";
cin >> nMovs;
}
}

int temp = 0;
bool swap;
//bubble sort the number of movies
do
{ swap = false;
for (int count = 0; count < (nStud - 1); count++)
{
if (ptr_1d[count] > ptr_1d[count + 1])
{

temp = nStud[count];
ptr_1d[count] = ptr_1d[count + 1];
ptr_1d[count + 1] = temp;
swap = true;
}
}
}
while (swap);

//MEDIAN
int median = 0;
if(total % 2 == 0)
{
median = static_cast<double>((nStud[total/2 - 1] + nStud[total/2]))/2;
cout << "Median of the list: " << median << endl;
}
else
{
median = nStud[total/2];
cout << "Median of the list: " << median << endl;
}
//MODE
for(int i = 0; i < total; i++)
{
for(int j = 0; j < total; j++)
{
if(nStud[i] == nStud[j])
check[i]++;//counter
}
if(check[i] > largestCount)
{
largestCount = check[i];
mode = nStud[i];
}
}





//Calculate average
average = total / nStud;

//Display results
cout << "Total movies: " << total << endl;
cout << "Average number of movies: " << average << endl;
}
What are the errors?
Topic archived. No new replies allowed.