-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBubbleSort.cpp
More file actions
73 lines (68 loc) · 1.41 KB
/
Copy pathBubbleSort.cpp
File metadata and controls
73 lines (68 loc) · 1.41 KB
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#include <iostream>
#include <iomanip>
#include <math.h>
#include <cmath>
#include <vector>
using namespace std;
int main()
{
cout << "Please insert the integers" << endl;
int n;
int a;
cin >> n >> a;
cout << "These are the integers created by a";
for (int i = 0; i < n; i++){
int k = pow(a, i);
int m = k % n;
cout << m << " ";
}
cout << endl;
cout << "These are the squares";
for (int i = 0; i < n; i++){
int k = pow(i, 2);
int m = k % n;
cout << m << " ";
}
cout << endl;
/*cout << "Please insert integer n" << endl;
}
int n;
cin >> n;
int s;
s = floor (pow(n, 0.5));
for (int i = 0; i < s + 1; i++){
for (int j = 0; j < i; j++){
if (pow(i, 2) + pow(j, 2) == n){
cout << "Two possible integers are: (" << i << ", " << j << ")" << endl;
cout << "Their sum is: " << i + j << endl;
}
}
}*/
/*cout << "Please insert the number of integers in the list" << endl;
int n;
cin >> n;
cout << "Please insert the integers in the list" << endl;
std::vector<int> integers (n);
for (int i = 0; i < n; i++){
cin >> integers[i];
}
int counter = 0;
while (counter < n){
counter = 0;
for (int i = 0; i < n - 1; i++){
if (integers[i] < integers[i + 1]){
int a = integers[i];
int b = integers[i + 1];
integers[i] = b;
integers[i + 1] = a;
}
else{
counter++;
}
}
}
cout << "The sorted list is ";
for (int i = 0; i < n; i++){
cout << integers[i];
}*/
}