forked from PhilipNelson5/AscentRateCalculator
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathARCfuncs.hpp
More file actions
36 lines (30 loc) · 781 Bytes
/
ARCfuncs.hpp
File metadata and controls
36 lines (30 loc) · 781 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
#ifndef ARCFUNCS
#define ARCFUNCS
#include <cmath>
#include <iostream>
#include <sstream>
double getInput(double defaultVal)
{
double value = defaultVal;
std::string input;
std::getline(std::cin, input);
if (!input.empty())
{
std::istringstream stream(input);
stream >> value;
}
return value;
}
double calcAscent(double lift, double chute, double payload, double balloon)
{
double top = 465.878 * sqrt((lift * 454.0) -
((chute / 16.0 * 454.0) + (payload * 454.0)));
double bot =
pow(((lift * 454.0) - ((chute / 16.0 * 454.0) + (payload * 454.0))) +
balloon + (payload * 454) + (chute / 16.0 * 454.0),
1.0 / 3.0);
double ft_min = top / bot;
double m_s = ft_min * .00508;
return m_s;
}
#endif