blob: c9681c597ec9ad35fffec6b34867b69c42a42e2e (
plain) (
blame)
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
|
//Name:Reece Warner
//Date:1/13/2024
//CST 116
//Homework2
#include <iostream>
#define VERBOSE
#ifdef VERBOSE
#endif
using std::cin;
using std::cout;
using std::endl;
int userinput=0;
const int tt = 32;
const double ctf = 9.0/5;
const double ftc = 5.0 / 9;
int main()
{
cout << "Would you like to convert Farenheit or Celsius?" << endl
<< "Type \"1\" for Farenheit, type \"2\" for Celsius" << endl;
cin >> userinput;
int Ftemp;
int Ctemp;
switch (userinput)
{
case (1):
{
cout << "What temperature would you like to convert?\n";
cin >> Ftemp;
cout << "Your converted temperature is:\n" << ftc * (Ftemp - 32) << endl;
int ftctemp = ftc * (Ftemp - 32);
if (ftctemp < 0)
{
cout << "That is below the freezing temperature of water!\nI hope you agree, Celsius is a better representation of the temperature!" << endl;
}
if (ftctemp == 0)
{
cout << "If you were a drop of water, you'd be frozen. Celsius seems a lot colder than our American temperature measurements" << endl;
}
if (ftctemp >= 100)
{
cout << "I hope you're a noodle and not a human because you're boiling!!!" << endl;
}
#ifdef VERBOSE
{
cout << "Your conversion process\n" << endl;
cout << ftc << "(" << Ftemp << "F" << "-" << tt << ") = " << ftctemp << "C" << endl;
}
#endif
break;
}
case (2):{
cout << "What temperature in Celsius would you like to convert?\n";
cin >> Ctemp;
cout << "Your converted temperature is:\n" << (ctf * Ctemp) + 32 << endl;
int ctftemp = (ctf * Ctemp) + 32;
if (ctftemp < 32) {
cout << "I bet these cold temperatures look confusing coming from Celsius:( Maybe grab a coat!" << endl;
}
if (ctftemp == 32) {
cout << "You are now at the freezing temperature of water! Try not to get any frost on your computer:)" << endl;
}
if (ctftemp >= 212) {
cout << "Please tell me you're not boiling yourself... I hope you're okay!" << endl;
}
#ifdef VERBOSE
{
cout << "Your conversion process\n" << endl;
cout << "(" << ctf << "*" << Ctemp << "C" << ") + " << tt << " = " << ctftemp << "F" << endl;
}
#endif
break;
}
default:
cout << "invalid input, I am not quite sure what you want from me:((" << endl;
}
return 0;
}
|