diff options
| -rw-r--r-- | BlankConsoleLab/BlankConsoleLab.cpp | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/BlankConsoleLab/BlankConsoleLab.cpp b/BlankConsoleLab/BlankConsoleLab.cpp index 2ea3bef..f9bf9b2 100644 --- a/BlankConsoleLab/BlankConsoleLab.cpp +++ b/BlankConsoleLab/BlankConsoleLab.cpp @@ -11,19 +11,19 @@ char n; int fahrenheit(int t); //changes celsius to farenheit -int fahrenheit(int t) +int fahrenheit(int x) { int f{}; //f = (t * (9 / 5)) + 32; - f = (9 / 5) * t + 32; + f = (9 / 5) * x + 32; return f; } int main() { - float t{}; + float x{}; int f{}; float w{}; float wc{}; @@ -31,24 +31,22 @@ int main() //collects a temp cout << "Enter a temperature between -80 and 121: "; - cin >> t; + cin >> x; //makes sure temp is between -80 and 121 - if (t < -80 || t > 121) + if (x < -80 || x > 121) { cout << "Input invalid, please enter a number between -80 and 121" << endl; cin.ignore(99, '\n'); - return t; } - + - cout << "type y or n" << " is the tempterature in fahrenheit?"<<endl; - cin >> t; - if (char choice = 'n') + cout << "type y or n," << " is the tempterature in fahrenheit?"<<endl; + if ('n') { - f = fahrenheit(t); + f = fahrenheit(x); } - else if (char choice = 'y') + else if (choice == 'y') { cin >> f; } @@ -61,7 +59,6 @@ int main() { cout << "Input invalid, please enter a number between 0 and 231" << endl; cin.ignore(99, '\n'); - return w; } //f = temp w = wind |