-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmisc_cpp.cpp
More file actions
64 lines (57 loc) · 1.4 KB
/
misc_cpp.cpp
File metadata and controls
64 lines (57 loc) · 1.4 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
#include <iostream>
#include <math.h>
using namespace std;
void char_out(){
unsigned char c=0;
do {
cout << (int)c << "\t";
++c;
}
while (c!=0);
return;
}
bool two_radiuses(double x, double y, double r, double R){
return x*x + y*y < R*R && x*x + y*y > r*r; //допустим кольцо открытое
}
double bij(double a, double b, double c, double d, double x){
double t = (x-b) / (a-b);
return t * c + (1-t) * d;
}
void graph() {
int height = 21;
int width = 41;
bool map[height][width];
int c = 0;
for(double x = -1.5; x <= 1.5; x += 3.0 / 40) {
++c;
int c_2=0;
for (double y = -1.5; y <= 1.5 && c_2<20; y += 3.0 / 20){
map[c_2][c] = ((x*x + y*y - 1) * (x*x + y*y - 1) * (x*x + y*y - 1) - x * x * y * y * y <= 0);
++c_2;
}
}
for(int i = 0; i < height; ++i){
for (int j = 0; j < width; ++j)
if (map[i][j]) cout << "*";
else cout << " ";
cout << endl;
}
}
unsigned long dots(double R)
{
unsigned int sum=2;
for(double y=R; y>-R; --y)
sum+=(unsigned int)(2*sqrt(R*R-y*y));
return sum;
}
void foobar(){
for(int i = 1; i <= 100; ++i) {
if (i % 3 == 0)
cout << "Foo";
if (i % 5 == 0)
cout << "Bar";
if (i % 3 != 0 && i % 5 != 0)
cout << i;
cout << endl;
}
}