Why dosent this work? i been trying to learn for hours now

#include
#include
using namespace std;

int main(void)
{
int i, temp;
int count = 0, mode = 0;
const int size = 8;
int num[size], numSorted[8];

cout > num[i];

for (i = 0; i num[i + 1])
{
temp = num[i];
num[i] = num[i + 1];
num[i + 1] = temp;
}
}

cout

Attached: 15563048827.png (680x566, 166K)

Other urls found in this thread:

en.cppreference.com/w/cpp/container/array
twitter.com/SFWRedditGifs

Ah bloo bloo

Practice hello world until you get it

No stack trace?

Are you a moron? He's trying to do bubble sort with a single for loop. It's just an algorithm problem not something a stack trace can fix my good god you are stupider than my dick

are you trying to sort? Me thinks you need to look at how minmax algo looks like

Yes I know it's a bubble sort but for all I know he forgot a semi colon somewhere. It's easier to debug a stacktrace rather than code.

"Doesn't work" in this case isn't a compiler error actually. Just realized that. He needs two for loops lol

Look at the for loop doing the swapping.

Write out an example, and increment 'i' as you go. Look at what happens when it does its final comparison of the value of 'i'.

Your for loops all technically iterate the same number of times. You should iterate up to 'i < size - 1' (not

You get this iteration.
if (num[7] > num[8])