[try Beta version]
Not logged in

 
BubbleSort

Pages: 123
Nov 8, 2016 at 2:23am
Write a function that performs a snap for the numbers array

void swap( int i, int) {
int k;
int l;
i=j
j-k
};

Im just wondering am I on the right track because this all I have so far cause I am stuck
Nov 8, 2016 at 2:24am
void swap(int &i, int &j) { int t = i; i = j; j = t; };
Nov 8, 2016 at 2:29am
why t instead of k ?? So, thats all I need for this function because I dont understand programming at all plus my teacher does not explain very well
Nov 8, 2016 at 2:32am
void swap(int &i, int &j) { int k = i; i = j; j = k; };

Why t instead of k ??

't' stands for "temporary".
Nov 8, 2016 at 2:35am
So, I was on the right track ???
Nov 8, 2016 at 2:37am
Not the right track at all.
1
2
3
4
5
6
void swap( int i, int) {
int k;
int l;
i=j
j-k
};

Your code does not even compile.
Last edited on Nov 8, 2016 at 2:37am
Nov 8, 2016 at 2:38am
thats what my teacher gave us and said it should work !
Nov 8, 2016 at 2:39am
Then how about this?
1
2
3
4
5
6
void swap( int i, int) {
int k;
int l;
i=j
j-k
};

You are missing some semi-colons (;) at the end of the statements.
Last edited on Nov 8, 2016 at 2:40am
Nov 8, 2016 at 2:42am
So this void swap is a array correct ??
Nov 8, 2016 at 2:43am
So this void swap is an array correct ??

No, not an array. This is not a swap function, but a broken one.
Nov 8, 2016 at 2:45am
Ugh, I dont know what I am doing. So, what is this then .
Nov 8, 2016 at 2:46am
What do you want to do with your swap function?
Nov 8, 2016 at 2:48am
Perform a snap for the numbers array
Nov 8, 2016 at 2:49am
Perform a snap for the numbers array

What do you mean?
Nov 8, 2016 at 2:51am
Thats what my teacher told us to do. He said write a function that performs a snap for the numbers array. Then he gave us that little code and said it should work
Nov 8, 2016 at 2:55am
What do you mean by snap?
Nov 8, 2016 at 2:58am
Would it be the same as bubblesort
Nov 8, 2016 at 2:59am
What is the original assignment?
Nov 8, 2016 at 3:11am
Write a function that performs a snap for the numbers array.
Nov 8, 2016 at 3:13am
What is the meaning difference between snap and swap?
Pages: 123