-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.cpp
51 lines (51 loc) · 1.06 KB
/
test.cpp
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
48
49
50
51
#include<iostream>
#include<iomanip>
using namespace std;
/*void sorting(int*banknote,int n)
{
bool flag=false;
for(int i=0;i<n;i++)
{
if(flag==true) break;
for(int j=0;j<n-i-1;j++)
{
if(banknote[j]>banknote[j+1])
{
int temp=banknote[j];
banknote[j+1]=banknote[j];
banknote[j]=temp;
flag=true;
}
}
}
}*/
int main()
{
int banknote[10]={1,8,2,5,4,4,3,2,1,5};
int n=10;
//sorting(arra,10);
bool flag=false;
for(int i=0;i<n-1;i++)
{
for(int j=0;j<n-1;j++)
{
for(int i=0;i<10;i++)
{
cout<<banknote[i];
}
cout<<endl;
if(banknote[j]>banknote[j+1])
{
int temp=banknote[j];
banknote[j]=banknote[j+1];
banknote[j+1]=temp;
flag=true;
}
}
if(flag==false) break;
}
for(int i=0;i<10;i++)
{
cout<<banknote[i];
}
}