#include <iostream>
#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[SIZE];
int j;
ifstream inputFile;
char GPA.txt[20];
inputFile.open(dataFile);
ofstream outputFile;
outputFile.open("GPA.txt");
char fileName[20];
cout<<" The file name is GPA.txt";
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;
inputFile.close();
system("pause");
return 0;
}
void sortArray (float array[], int SIZE)
{
bool swap;
float GPA;
C:\Users\Glenda hayes\Documents\c++ programing labs\lab6.cpp: In function `int main()':
C:\Users\Glenda hayes\Documents\c++ programing labs\lab6.cpp:15: error: expected primary-expression before "char"
C:\Users\Glenda hayes\Documents\c++ programing labs\lab6.cpp:15: error: expected `;' before "char"
C:\Users\Glenda hayes\Documents\c++ programing labs\lab6.cpp:17: error: `dataFile' undeclared (first use this function)
C:\Users\Glenda hayes\Documents\c++ programing labs\lab6.cpp:17: error: (Each undeclared identifier is reported only once for each function it appears in.)
C:\Users\Glenda hayes\Documents\c++ programing labs\lab6.cpp:22: error: request for member `txt' in `GPA', which is of non-class type `int[100]'
Upload your Lab6.cpp and Lab6.txt file, and your GPA data file. I will also use my own data file to test your program. This lab uses parallel arrays and sorting techniques. Read in 4 digit student numbers and gpa scores from a data file into two parallel arrays. You should prompt the user and use a cin statement to read the file name into a char variable (char dataFile[20];), then use that char variable in your open statement (inputFile.open(dataFile);). The file will be a text file and the format will be student number on one line and GPA on the next line.
Set the array size to 100, but read in and store values into your array only until the value of 99.9 for GPA is read. (Hint, don't use == for float values, check for GPA >99). 99.9 is the sentinal value in the file.
Once you have populated the array, sort the arrays in ascending order by GPA score and print the results to the screen.
The format for your input file should be something like this:
1111
3.2
1222
1.8
1333
4.0
0000
99.9
this is why... i am trying to get it to work like this and this is why i have the 99 in there.