Why my code works as wasn't planed? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Why my code works as wasn't planed?

This code should sort massive, but sometimes it return random big numbers https://code.sololearn.com/c6EWPF6Zh3or/?ref=app

9th Mar 2018, 11:08 AM
Максим
Максим - avatar
2 Answers
0
Hello! I don’t understand what your code code is supposed to do but I can guess why you are getting random numbers. Normally when you get random big numbers is when you use a variable that wasn’t assigned a value. Like this... int var; cout << var; // will print out a random integer Also I would recommend to make the variable names more descriptive than just x, a, b at the start of main
11th Mar 2018, 1:03 AM
TurtleShell
TurtleShell - avatar
0
this code must sort the array, even numbers must go to the beginning, then odd numbers.
11th Mar 2018, 4:17 AM
Максим
Максим - avatar