need some help figuring stuff

hi
i have this problems:
1>h:\comp122\ilab\w6\tayo_mark_ilab_w6\tayo_mark_ilab_w6\tayo_mark_ilab_w6.cpp(90): error C2061: syntax error : identifier 'ar'
1>h:\comp122\ilab\w6\tayo_mark_ilab_w6\tayo_mark_ilab_w6\tayo_mark_ilab_w6.cpp(91): error C2143: syntax error : missing ')' before '}'
1>h:\comp122\ilab\w6\tayo_mark_ilab_w6\tayo_mark_ilab_w6\tayo_mark_ilab_w6.cpp(91): error C2143: syntax error : missing ';' before ')'

it's in this line, 7th to the last line: return static_cast < int ar[size / 2];

could someone tell me how to fix this. i'm lost. thanks you!!





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

double mean(int ar[], int size);
void bubbleSort(int ar[], int size);
double median(int ar [], int size);

const int SIZE = 100;
int main()
{
int grades[SIZE];
int arraySize;
int index;

do
{
cout << "Enter the number grade <1...100>: ";
cin >> arraySize;
}while(arraySize >= 1 || arraySize < 100); //write the condition for the loop

for(index = 0; index < arraySize; index++)
{
cout << "Enter grade: " << endl;
cin >> grades[SIZE];
if(grades[SIZE] < 0 || grades[SIZE] > 100)
{
cout << "Grades..........." << endl;
index--; //or --index;
}//end if

}//end for loop

//write a statement to display the mean with 2 decimal digits
cout << "The mean of the grade is " << setprecision(2) << endl; //function calls

bubbleSort(grades, arraySize);

//write a cout satement that calls the median function
//and displays the return value of the function
return 0;
}

double mean(int ar[], int size)
{
double total = 0.0;
int index = 0;
for(index = 0; index < size; index++)
{
total = total + ar[index];
}//end for loop
return total;
}//end sumArray

void bubbleSort(int ar[], int size)
{
int pass, index, temp;
for(pass = 0; pass < size -1; pass++)
{
//cout << "\tindex = " << index << " Array: ";
for(index = 0; index < -1; index++)
{
//cout <<
if(ar[index] > ar[index + 1])
{
temp = ar[index];
ar[index] = ar[index+1];
ar[index+1] = temp;
}
//displayArray(ar, size);
cout << endl;
}//end index loop

//displayArray(ar, size);
cout << endl;
}//end count loop
}//end bubbleSort

double median(int ar [], int size)
{
if(size % 2 == 1 )//odd number of entries
{
return static_cast < int ar[size / 2];
}//end if

else
{
return (ar[size / 2] + ar[size/2 -1])/ 2.0;
}
}//end median
Topic archived. No new replies allowed.