Question: please help me fix this assembling code, my output is negative number when choosing sorting mode, output: sorting mode ( 0 for ascending, 1 for
please help me fix this assembling code, my output is negative number when choosing sorting mode, output: sorting mode for ascending, for descending:
C:UsersuserDocumentsfinal projectDebugprojectexe process exited with code
Press any key to close this window it supposed to sort an array of integers by chosen mode either ascending or descending order. The function receives the array and the array size from a CC program. The array of integers should be created and populated with values inside the CC program. here is my test code add comments every lines to help me understand better please: #include
#include
using namespace std;
void ghostFunction;
void showArrayint arr int size;
void bubbleSortint arr int size, int mode;
extern C void bubbleSortASMint arr int size, int mode;
int main
const int SIZE ;
int myArrSIZE;
int secondArrSIZE;
for int i ; i SIZE; i
myArri rand;
secondArri myArri;
int sortingOrder;
cout "sorting mode for ascending, for descending: ;
cin sortingOrder;
timet t; time variable in milliseconds
t clock; obtain current time in milliseconds
ghostFunction;
bubbleSortASMmyArr SIZE, ;
long int time clock t;
showArraymyArr SIZE;
cout "Time to execute function: time milliseconds
;
return ;
to do something of long duration
void ghostFunction
double num ;
for int i ; i ; i
num i;
void bubbleSortint arr int size, int md
int temp ;
for int idx ; idx size ; idx
for int j ; j size ; j
if md
sorting ascending
if arrj arrj
swap
temp arrj;
arrj arrj ;
arrj temp;
else
sorting descending
if arrj arrj
swap
temp arrj;
arrj arrj ;
arrj temp;
void showArrayint arr int size
for int i ; i size; i
cout arri;
cout endl;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
