+ 3
How can i print each passes? Thank you
Heres my code https://code.sololearn.com/ceoMn4MPpGfe/?ref=app
29 Respostas
+ 1
Hii bro finally I have modified your original code and now it's working fine...
This is the modified one....
https://code.sololearn.com/cU52tEFs8E3V
there were some warnings and some silent errors which i had removed.
Let's check it once and let me know
+ 1
@Juven Perante Torres
Hey, You should see this code and let me know if you are satisfied...
https://code.sololearn.com/c53gSLAZF9Nm
Thanks for asking..
+ 1
Thanks
+ 1
But i need is it can work on my code with passes/iteration can you show me?
+ 1
The main victim is continue; statement in your code. Once this condition `elem<arr[i-1]` returns false ==> else statement execute and continue means skip all and again start new iteration.
To resolve this you also have to print the pass/iteration inside else statment just before continue; .
This is the implementation
https://code.sololearn.com/cU52tEFs8E3V
Thanks...
+ 1
Its not working
+ 1
Can you gimme the input you are trying ?
because it's working on my side.
+ 1
I think you have .modified and tried on your code..
If this is case..
Please check which i had posted and then let me know.
+ 1
Like this
[1]Ascending [2]Descensing
1
How many array [4]minimum [16] maximum
4
Enter array elements:
4 1 5 2
Pass
1 4
1 4 5
1 2 4 5
Sorted array
1 2 4 5
+ 1
I am not understanding in which form the pass you want ?
Do you want array in each pass or only sorted part ?
My code gives array after each pass.....
+ 1
I want my code when running ia look like that
+ 1
Your is not working it show errors in printing passes but it ia not in logical error
+ 1
Can u please paste the code here that you are running .
+ 1
The one that you sent i use codeblocks ide
+ 1
Bro, because of the issue, i installed code blocks ide on my pc and run the code I had posted and I got the following results ..........
### test case 1 ######
Enter the Size for Array: 4
Enter 4 Array Elements: 4 1 5 2
Step 1: 1 4 5 2
Step 2: 1 4 5 2
Step 3: 1 2 4 5
The New Array (Sorted Array):
1 2 4 5
#### test case 2 ######
Enter the Size for Array: 5
Enter 5 Array Elements: 10 20 30 40 50
Step 1: 10 20 30 40 50
Step 2: 10 20 30 40 50
Step 3: 10 20 30 40 50
Step 4: 10 20 30 40 50
The New Array (Sorted Array):
10 20 30 40 50
#### test case 3 ######
Enter the Size for Array: 5
Enter 5 Array Elements: 50 40 30 20 10
Step 1: 40 50 30 20 10
Step 2: 30 40 50 20 10
Step 3: 20 30 40 50 10
Step 4: 10 20 30 40 50
The New Array (Sorted Array):
10 20 30 40 50
-------------------------
I haven't got any syntax error..... i am not getting what is problem with your ide...
+ 1
Im so sorry i sent the wrong codes. Here mine that i want to have a passes
https://code.sololearn.com/c1McjP4gY2I2/?ref=app
+ 1
Please help mo bro im so sorry
+ 1
Thank you bro. Godbless you and your family
+ 1
You are welcome bro, please mark it as the best answer if it really helped you.
+ 1
How can i mark it?