-
Notifications
You must be signed in to change notification settings - Fork 85
Expand file tree
/
Copy pathmystery.cpp
More file actions
43 lines (31 loc) · 704 Bytes
/
mystery.cpp
File metadata and controls
43 lines (31 loc) · 704 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
#include <iostream>
#include <vector>
using namespace std;
void print(auto A)
{
for (auto a : A)
cout <<a<<" ";
cout<<endl;
}
void mystery1(auto& Data)
{
cout<<endl<<"Mystery 1"<<endl<<"---------------------"<<endl;
for ( int i = 0 ; i < Data.size( ) ; i++)
{
for ( int j = 0 ; j < i ; j++)
if ( Data[ i ] < Data[ j ] )
swap( Data[ i ] , Data[ j ] );
print(Data);
}//end outer for (this brace is needed to include the print statement)
}
//... Other mysteries...
int main()
{
vector<int> Data = {36, 18, 22, 30, 29, 25, 12};
vector<int> D1 = Data;
vector<int> D2 = Data;
vector<int> D3 = Data;
mystery1(D1);
mystery2(D2);
mystery3(D3);
}