#include <fstream>
using namespace std;
//this program is going to output the student id and gpa in accending order
//function prototype
void sortArray(float,int);
int main()
{
const int SIZE= 100; //Array size
int id[SIZE];
int GPA;
int j;
ifstream inputFile;
char dataFile[20];
inputFile.open("dataFile.txt");
char fileName[20];
cout<<" The file name is GPA.txt";
ofstream outputFile;
outputFile.open("GPA.txt");
cout<<id<<endl;
cout<<GPA<<endl;
for(j = 0; j< SIZE; j++)
{
cout<<"please enter the student id number"<<endl;
cin>>id[j];
cout<<"please enter the gpa. "<<endl;
while(GPA!=99)
{
cout<<"please enter the gpa. ";
cin>>GPA;
cout<<GPA;
}
sortArray(GPA, SIZE);
inputFile.close();
outputFile.close();
system("pause");
return 0;
}
}
void sortArray (float array[],int SIZE)
{
bool swap;
float GPA;
do
{
swap=false;
for(count=0; count>(SIZE-1); count++)
{
if(array[SIZE]> array[SIZE + 1])
{
GPA=array[SIZE];
array[SIZE]=array[SIZE + 1];
array[SIZE + 1] = GPA;
swap = true;
}
}
} while (swap);
cout<<GPA<<endl;
}
}
}
errors are
_____________________
In function `void sortArray(float*, int)':
: error: overloaded function with no contextual type information
: error: invalid operands of types `<unknown type>' and `int' to binary `operator>'
error: no post-increment operator for type
At global scope:
error: expected declaration before '}' token
Execution terminated