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
|
#include <iostream>
int solveQ(int M, int C, int T1, int T2);
int solveM(int Q, int C , int T1, int T2, int T);
int main()
{
int choice;
int Q;
int M;
int C;
int T1;
int T2;
int T;
std::cout << "What are you trying to solve for? press (1) for Q, (2) for M, or (3) for C? ";
std::cin >> choice;
if (choice == 1)
{
std::cout << "Enter M: ";
std::cin >> M;
std::cout << "Enter C: ";
std::cin >> C;
std::cout << "Enter T1: ";
std::cin >> T1;
std::cout << "Enter T2: ";
std::cin >> T2;
Q = solveQ(M, C, T1, T2);
std::cout << Q << " is your answer";
return 0;
}
if (choice == 2)
{
std::cout << "Enter Q: ";
std::cin >> Q;
std::cout << "Enter C: ";
std::cin >> C;
std::cout << "Enter T1: ";
std::cin >> T1;
std::cout << "Enter T2: ";
std::cin >> T2;
Q = solveM(Q, C, T1, T2, T);
std::cout << M << " is your answer";
return 0;
}
}
int solveQ(int M, int C, int T1, int T2)
{
int Q;
Q = (M * C * (T1 - T2));
return Q;
}
int solveM(int Q, int C , int T1, int T2, int T)
{
int M;
T = (T1 - T2);
M = (Q / C / T);
return M;
}
|