62 570
Assignments Done
99%
Successfully Done
In June 2018

Answer to Question #10412 in C++ for hamee

Question #10412
write a program in modular programming asking for an array of 6 students gpa in ascending order
Expert's answer
#include "stdafx.h"
#include <iostream>
#include <conio.h>

using namespace std;
int arrayiofgpa[100];
void sort(int ar[], int size)
{
int temp;
for(int i = 0; i < size; i++)
for(int j = 0; j < size - i - 1; j++)
if(ar[j] > ar[j + 1])
{
temp = ar[j];
ar[j] = ar[j + 1];
ar[j + 1] = temp;
}
}
int _tmain(int argc, _TCHAR* argv[])
{
for(int i=0;i<6;i++){
cout<<"Enter gpa for student "<<(i+1)<<": ";
cin>>arrayiofgpa[i];
}
sort(arrayiofgpa,6);
cout<<"GPF in ascending order is: ";
for(int i=0;i<6;i++){
cout<<arrayiofgpa[i]<<" ";
}
getch();
return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions