Question: Modify this sample to include a class that is called MyArray. You need to put the sorting code into this class. For example, move the

Modify this sample to include a class that is called MyArray. You need to put the sorting code into this class. For example, move the execution code (the sorting part) from main() to the class MyArray.

#include #include

int A[]={3,1,-2,5,9,-100,6,7,35,20};

int main() { int i,j; int n=10; for (j=n-1;j>0;j--){ // this is not a full-bubble-sort; can be improved for (i=0;i A[i+1]) { // swap them int temp=A[i]; // swap needs a place to save a # A[i]=A[i+1]; // this assignment will erase original A[i]. A[i+1]=temp; } } } for (i=0;i

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!