diff options
Diffstat (limited to 'BlankConsoleLab/cst116-lab2-stark.cpp')
| -rw-r--r-- | BlankConsoleLab/cst116-lab2-stark.cpp | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/BlankConsoleLab/cst116-lab2-stark.cpp b/BlankConsoleLab/cst116-lab2-stark.cpp index aca24a4..327cb11 100644 --- a/BlankConsoleLab/cst116-lab2-stark.cpp +++ b/BlankConsoleLab/cst116-lab2-stark.cpp @@ -14,18 +14,23 @@ void inputTemp(float& cTemp, float& fTemp); const float fMin = -80, fMax = 121, cMin = -62, cMax = 49.5, wMin = 0, wMax = 231; //Minimum and maximum valid ranges for all user inputs int main() { - char tempType; float cTemp, fTemp; cout << "Welcome to Cold Calculator v0.2" << endl; + inputTemp(cTemp, fTemp); +} + +void inputTemp(float& cTemp, float& fTemp) { + char tempType; + cout << "Would you like to enter the temperature in Celcius (c) or Fahrenehit (f)?" << endl; do { - cin >> tempType; - cout << endl; - if (tempType != 'f' && tempType != 'c') { - cout << "Input the character 'c' or 'f'!" << endl; - } + cin >> tempType; + cout << endl; + if (tempType != 'f' && tempType != 'c') { + cout << "Input the character 'c' or 'f'!" << endl; + } } while (tempType != 'f' && tempType != 'c'); if (tempType == 'c') { @@ -50,10 +55,9 @@ int main() { cTemp = tempConverter(fTemp, 1); } while (fTemp < fMin || fTemp > fMax); } - - } + // Direction is 0 if going celcius to fahrenheit and 1 if going fahrenheit to celcius float tempConverter(float temp, bool dirc) { float cTemp; @@ -66,8 +70,4 @@ float tempConverter(float temp, bool dirc) { } return cTemp; -} - -void inputTemp(float& cTemp, float& fTemp) { - -} +}
\ No newline at end of file |