[ create a new paste ] login | about

Link: http://codepad.org/u3TfO98c    [ raw code | fork ]

C++, pasted on May 16:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// 751
#include <iostream> 
using namespace std; 
void swap(int &a); 
int main() { 
	int a[5]={34,3,11,28,17}; 
	const int N = 5; 

	swap(*a);
	for (int i=0; i<N; i++)
		cout << " " << a[i];
}
void swap(int &a) {
	int *b = &a;
	const int N = 5; 

	for(int i=N-1; i>0; i--) 
		for(int j=0; j<i; j++) 
			if(b[j] > b[j+1]) 
				swap(b[j], b[j+1]); 
}


Create a new paste based on this one


Comments: