blob: 928b2cc451ab5421dcdd915dae59d29d110214e3 (
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
|
// Lab 2 Alexandra Apetroaei (CST 116)
#include <iostream>
#include <iomanip>
#include <cmath>
using namespace std;
using std::cout;
using std::cin;
using std::string;
using std::endl;
float fahr;
float cel;
float mph;
char input;
char menu;
int main()
{
//ask user to choose temperature calculations
cout << "Do you want to enter temperature in Farenheit? or Celcius?" << endl;
cout << "Options: Farenheit (f) Celcius (c)." << endl;
//converter to use
cin >> input;
//if user types f, using farenheit
if (input == 'f')
{
// ask user to input temperature
cout << "Please enter temperature in Farenheit:" << endl;
cin >> fahr;
//Display result of calculation
}
//if user types c, using celcius
else if (input == 'c')
{
cout << "Please enter temperature in Celcius:" << endl;
cin >> cel;
fahr = ((cel * 9.0 / 5.0) + 32.0);
}
return 0;
}
|