summaryrefslogtreecommitdiff
path: root/BlankConsoleLab/BlankConsoleLab.cpp
blob: 256ee34bf4da56980e5ca2e3957e2e8ff3c5c461 (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
// BlankConsoleLab.cpp : This file contains the 'main' function. Program execution begins and ends there.
//

#include <iostream>

using namespace std;

using std::cout;
using std::cin;
using std::endl;

float UserInputTemp;
float WindSpeed;
char CorF;


float CelciusToFarenheit(float Celcius2Farenheit) {
    Celcius2Farenheit = (UserInputTemp * (9 / 5)) + 32;
    return Celcius2Farenheit;
}

int main()
{

    cout << "Please enter a temperature in Celcius or Farenheit: ";
    cin >> UserInputTemp;
    cout << "If you entered a temperature in Celcius please enter 'C' and if you entered a temperature in Farenheit please enter 'F'. ";
    cin  >> CorF;
    
    while (CorF != 'C' && CorF != 'F') {
        cout << "Please enter either 'C' or 'F': ";
        cin >> CorF;
    }   
    if (CorF == 'F') {
        while (UserInputTemp < -80 || UserInputTemp > 121) {
            cout << "Please enter a temperature between -80 and 121." << endl;
            cout << "Please enter a temperature in Farenheit: ";
            cin >> UserInputTemp;
        }
    }
    else if (CorF == 'C') {
        while (UserInputTemp < -62 || UserInputTemp > 49.5) {
            cout << "Please enter a temperature between -62 and 49.5." << endl;
            cout << "Please enter a temperature in Celcius: ";
            cin >> UserInputTemp;
        }
        cout << "The temperature you entered is " << CelciusToFarenheit(UserInputTemp) << " degrees in Farenheit." << endl;
    }
  

   

    cout << "Please enter a wind speed in Miles Per Hour: ";
    cin >> WindSpeed;
    while (WindSpeed < 0 || WindSpeed > 231) {
        cout << "Please enter a wind speed between 0 and 231 Miles Per Hour" << endl;
        cout << "Please enter a wind speed in Miles Per Hour: ";
        cin >> WindSpeed;
    }

    
    //cout << "The temperature you entered is " << CelciusToFarenheit(UserInputTemp) << " degrees in Farenheit." << endl;
    
    return 0;
}