+ 5
Please help to find the error my code
The concept of the code is: 1.Ask the user to enter a group of elements of the array 2.ask the user to choose wich order he wants to sort the array 3.ask the user to enter an element in order to search it the array (Found or not found) https://code.sololearn.com/chpEJP73rzEE/?ref=app
31 odpowiedzi
- 2
The biggest problem is that you did not assign any initial values to the following variables : d, g, premier, dernier, even though you used them in functions.
I think you mean by premier the first and by dernier the last so, you have to add this two line befor using them :
premier = 0;
dernier = n-1;
i don't know what d, g need for, but you have to assign them initial values.
in line 104 remove return, and add return 0; at the end of code.
+ 3
In lines 80 and 81. Make it lecture(t, x); and
affichage(t, x); n has no value there.
+ 1
Why are t and n arguments for these functions? n doesn't have an value yet. x has a value, but you aren't using it.
lecture(t,n);//calling the function in order to enter the elements of the array
affichage(t,n);//printing them
+ 1
Yes indeed.
+ 1
https://code.sololearn.com/cFyP2uHKtSvF/?ref=app
Fixed the code have a look.
+ 1
Thank so much rafik for your effort
0
t it is an array ,and n it is the size
#for(i=0;i<n;i++)
Scanf("%d",&t[i])
0
I did not understand what do you mean
0
Salam,
1st use pointer *t instead of t[] in each function parameter.
0
2nd, line 79 you wrote this :
scanf("%d", &x);
lecture(t, n);
Changr x by n : scanf("%d", &n);
0
i=g and j=d
0
yes i see that inside the function, but in main() function, g = ? And d = ?.
0
Why please is it necessary
0
You used d and g as tri_croissant_rapid function parameters,
tri_croissant_rappide(t,n,g,d); in line 91
but g and d have no value, how the function will use them?
0
What do you mean by d and g? what's their role in the code?
0
Gauche for g and droite for d
Quick sort method in ascending order
I can also use low and high
0
Usually، use 0 for the low value, and n-1 (array.size() -1) for the hight value.
0
In the main function ??
0
Okay thank you so much for your help
0
U r welcome.