Question: Modify this C++ program; It should show in descending ID order. The sample output is down below: #include #include #include using namespace std; struct sTy

Modify this C++ program; It should show in descending ID order. The sample output is down below:

#include

#include

#include

using namespace std;

struct sTy

{

char fName[15];

char LName[15];

int Id;

double Gr;

};

void pStDat(const sTy& stu);

int main()

{

int n=0;

sTy stt;

sTy *A;

ifstream iF;

ofstream oF;

long stsize = sizeof(stt);

iF.open ("studentRec.txt");

if(!iF)

{

cout

return 1;

}

iF.open("student.dat", ios::binary);

if (!iF)

{

cout

return 1;

}

iF.read(reinterpret_cast (&stt),sizeof (stt));

A=new sTy[n];

int i=0;

while (iF)

{

if (stt.Id != 0)

{

A[i]=stt;

i++;

pStDat(stt);

}

iF.read(reinterpret_cast (&stt),sizeof (stt));

};

cout

cout

cout

for(int i=0; i

{

for(int j=0; j

{

if(A[j].Id

{

sTy temp;

temp=A[j];

A[j]=A[j+1];

A[j+1]=temp;

}

}

}

for(int i=0; i

{

pStDat(A[i]);

}

return 0;

}

void pStDat(const sTy& stu)

{

cout

}

-------------------------------------------------------------------------------------------

studentRec.txt

1 Mike L. 3.9

3 Jen B. 3.5

5 Beth Y. 2.9

4 Roy E. 2.5

2 Olga U. 3.4

Modify this C++ program; It should show in descending ID order. The

Descending ID Output: ID First Name Last Name GPA 5 Beth 4 Roy 3 Jen 2 Olga 1 Mike 2.9 2.5 3.5 3.4 3.9 Y. E. U. L

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!