-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
91 lines (72 loc) · 1.74 KB
/
main.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
#include <QCoreApplication>
#include <iostream>
using namespace std;
int main()
{
float delta, x, farea;
float a,b,c,d;
float sum = 0;
cout<<"\n pipe spacing [cm]:";
cin>>delta;
cout<<"\n lenght wall A [cm]:";
cin>>a;
cout<<"\n lenght wall B [cm]:";
cin>>b;
c=a;//side c=a
d=b;//side d=b
cout<<"\n============================\n";
//floading area
farea = (a*b)/10000;
cout<<"floading area: "<<farea<<" [m2]\n";
if (farea>39) {
cout<<"ERROR! Floading area is too big! Should be less than 40m2\n";
exit(0);
}
//the ratio of the lengths of the sides of the plate
if (a/b >=2){
cout<<"ERROR! The ratio of lenghts sides should be <2, now a/b: "<<a/b<<"\n";
exit(0);
}
if (b/a >=2){
cout<<"ERROR! The ratio of lenghts sides should be <2, now b/a: "<<b/a<<"\n";
exit(0);
}
//wall A
x=0;
x = a - delta;
sum = x;
x = x - delta;
sum = sum + x;
do {
x = x - delta * 2;
sum = sum + x;
}while(x-delta>0);
//wall B
x = b - delta * 2;
sum = sum + x;
do {
x = x - delta * 2;
sum = sum + x;
}while(x-delta>0);
//strona C
x = c - delta * 2;
sum = sum + x;
do {
x = x - delta * 2;
sum = sum + x;
}while(x-delta>0);
//wall D
x = d - delta * 4;
sum = sum + x;
do {
x = x - delta * 2;
sum = sum + x;
}while(x-delta>0);
cout <<"\nPipe lenght: "<<sum/100<<" [m]\n";
if (sum/100 > 100) {
cout<<"ERROR! Pipe lenght is too long, should be less than 100m\n";
exit(0);
}
cout<<"\n\n";
return 0;
}