-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPrintSort.cpp
More file actions
47 lines (41 loc) · 905 Bytes
/
PrintSort.cpp
File metadata and controls
47 lines (41 loc) · 905 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#include <iostream>
#include <vector>
#include <queue>
void A_sort(int *nl,int q) {
int temp;
for(int i=1;i<q;i++){
for(int j=1;j<q-i;j++){
if(nl[j]>nl[j+1]){
temp=nl[j];
nl[j]=nl[j+1];
nl[j+1]=temp;
}
}
}
}
struct TreeNode{
int val;
TreeNode *left;
TreeNode *right;
TreeNode(int x):val(x),left(NULL),right(NULL){}
};
int main() {
//std::cout << "Hello, World!\n";
//std::cout << "year\n";
//int year;
//std::cin>>year;
//std::cout << "year is " << year << "\n";
std::cout << "sortNumble, input n numble\n";
int q;
std::cin>>q;
int sortNumble[q];
for(int i=0;i<q;i++){
std::cin>>sortNumble[i];
}
A_sort(sortNumble,q);
for(int i=0;i<q;i++){
std::cout<<sortNumble[i]<< " ";
}
std::cout<<"\n";
return 0;
}