-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
65 lines (58 loc) · 2.01 KB
/
Copy pathmain.cpp
File metadata and controls
65 lines (58 loc) · 2.01 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
#include <iostream>
using namespace std;
double dayPrice(int days){
int dP = 52; // 4 times 3euros for meals + 40 for camping
int full = (days*dP)+200; // + 200 for material
return full/days;
}
int main()
{
cout << " " << endl;
cout << " ///" << endl;
cout << " \\\\ ///" << endl;
cout << " \\\\ ///" << endl;
cout << " \\\\ //\\\\ ///" << endl;
cout << " \\\\ // \\\\ ///" << endl;
cout << " \\\\// \\\\///" << endl;
cout << " " << endl;
cout << "Wandrn - Your trek planner !" << endl;
cout << "" << endl;
cout << "Trek level (how many hours do you walk a day) " ;
double level;
cin >> level;
double d;
cout << "How long is your trip ? (in km) (and think of the way back) " ;
cin>>d;
double speed;
cout << "How fast are you ? (in km/h) " ;
cin>>speed;
double time = d/speed;
cout << "" << endl;
if(time > 24){
time /= 24;
int tima = time*(24/level);
double proday = dayPrice(tima);
cout << "Trip length (non stop) : " << time << " days" << endl;
cout << "Trip length (" << level << "h/day): " << tima << " days" << endl;
cout << "Price (/day) : " << proday << " euros" << endl;
cout << "Price (global) : " << proday*tima << " euros" << endl;
}
if(time < 1){
time *= 60;
cout << "Trip length : " << time << " minutes" << endl;
}
time = d/speed;
if(time>=1 & time<24){
int time_hours = d/speed;
double time_full = d/speed;
double minutes_decimal = time_full-time_hours;
double minutes = minutes_decimal*60;
cout << "Trip length : " << time_hours << " hours " << minutes << " minutes." << endl;
if(time>4){
int timb = d/speed;
int meals = timb/4;
cout << "Don't forget to bring " << meals << " meals." << endl;
}
}
return 0;
}