+1(805) 568 7317

i wrote a c code in visual basic this is my code include void swap double xp double 4950375

I wrote a C++ code in visual basic. This is my code: #include void swap(double *xp, double *yp)


double temp = *xp;

*xp = *yp;

*yp = temp;

} void sort(double arr[], int n)


int i, j, min_idx; for (i = 0; i

{ min_idx = i;

for (j = i+1; j

if (arr[j]

min_idx = j; swap(&arr[min_idx], &arr[i]);



int main()


const int n=20;

int N=1;



printf(“How many numbers they would like to enter (5-20):”);

scanf(“%d” ,&N);

if (N20)


printf(“Please enter a value between 5 and 20n”);



double data[n];

for(int i=0; i {


while (data[i]100 )


printf(“Enter number “


printf(“Sorted Array:”);

for(int i=0; i {

printf(“%dn” ,data[i] );


return 0;

} I want the code to do the following: – Ask the user how many numbers they would like to enter(5-20). – Check if the value they entered is within the range of 5-20.If not, ask them to enter a value between 5 and 20 until youreceive a response in that range. Store this value in a variablenamed “N”. – When the user correctly enters N = the number of values(between 5-20), ask them for the first number. Tell them the numberhas to be between 1-100. Check if the number is between 1-100. Ifnot, ask until they enter a number between 1-100. – Repeat asking for new numbers and checking the validity of thenumbers until the user enters the correct amount of numbers theyspecified in the beginning (N). – Store these values in an array of size N. The name of thearray should be “data”. – After the user finishes entering all the numbers, sort thenumbers in ascending order using any exchange (swapping)-basedsorting algorithm. Use a function named “sort” to accomplish thesorting, and within this function, call another function named”swap” to accomplish the swapping task. No part of the actualsorting or swapping should occur in the main function. You willneed to pass the data array as a whole into the “sort” function.You will also need to pass two values that you are swapping to the”swap” function when needed. – Print on the screen the numbers in ascending order. but the code does not work. Attached

"Order a similar paper and get 15% discount on your first order with us
Use the following coupon

Order Now