THHIS IS RESOLVED I FORGOT THE '=' IN MY WHILE STATEMENT Howdy ya'll I writing an insertion sort and for some reason the first element of my sorted array isn't what it is supposed to be please help. this is the first few of my output
85925 56727 6849
85925 38 412 487 491 506 604 626
662 784 880 914 974 1271 1312 1451
1801 2231 2256 2346 2964 2974 3120 3169
Andrew Hodel wrote:THHIS IS RESOLVED I FORGOT THE '=' IN MY WHILE STATEMENT
Yeah. That's why you shouldn't write
It's too easy to make a tiny error and write this instead:
Which as you now know, doesn't do what you expected. So you should almost never compare boolean values against the literals true and false; you should just write
posted 3 years ago
What are you talking about? My print was fine, I forgot to put <= so it wasn't comparing my first value in my sort method. But thanks for the little tid bit, that is a much cleaner way to write the if statement.
What are you doing? You are supposed to be reading this tiny ad!
the new thread boost feature brings a LOT of attention to your favorite threads