Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
bubble sort
//clang 3.8.0 #include <iostream> void bubbleSort(int *nums,int size){ for(int i=0;i<size;++i ){ bool swapped=false; for(int y=0;y<size-i-1;++y ){ if(nums[y]>nums[y+1]){ std::swap(nums[y],nums[y+1]); swapped=true; } } if(!swapped) break; } } void printArray(int *nums,int size){ for(int i=0;i<size;++i ) std::cout<<nums[i]<<" "; } int main() { int nums[]={9,8,7,4,3,6}; int size=sizeof(nums)/sizeof(nums[0]); bubbleSort(nums,size); printArray(nums,size); }
run
|
edit
|
history
|
help
0
AnnotateAttr templated test
C++ Template
Zadanie Dejwu
problem_name_4
Throttle Example in C++
non-deduced context
2574 EC
001
INHERIT_CTORS default constructor
template specialization inheritance problem