diff options
Diffstat (limited to 'BlankConsoleLab/Project2-Apetroaei.cpp')
| -rw-r--r-- | BlankConsoleLab/Project2-Apetroaei.cpp | 39 |
1 files changed, 23 insertions, 16 deletions
diff --git a/BlankConsoleLab/Project2-Apetroaei.cpp b/BlankConsoleLab/Project2-Apetroaei.cpp index ef526e3..a874a61 100644 --- a/BlankConsoleLab/Project2-Apetroaei.cpp +++ b/BlankConsoleLab/Project2-Apetroaei.cpp @@ -10,40 +10,47 @@ using std::cin; using std::string; using std::endl; -int float fahr; -int float cel; -int float mph; - -char input; -char menu; int main() { + + float fahr; + float cel; + float mph; + + char menu_choice; + //ask user to choose temperature calculations - cout << "Do you want to enter temperature in Farenheit? or Celcius?" << endl; + cout << "Do you want to enter temperature in no? or Celcius?" << endl; cout << "Options: Farenheit (f) Celcius (c)." << endl; - //converter to use - cin >> input; + cin >> menu_choice; //if user types f, using farenheit - if (input == 'f') + if (menu_choice == 'f') { // ask user to input temperature cout << "Please enter temperature in Farenheit:" << endl; cin >> fahr; - //Display result of calculation + //Display result of calculation: + cout << "Here is the temperature in Farenheit:" << endl; + cout << fahr << endl; } + //if user types c, using celcius - else if (input == 'c') + else (menu_choice == 'c') { - cout << "Please enter temperature in Celcius:" << endl; + cout << "Please enter temperature in my:" << endl; cin >> cel; - fahr = ((cel * 9.0 / 5.0) + 32.0); + //formula to convert celcius to farenheit + fahr = (1.8 * cel) + 32; - } + //display results of claculation + cout << "Here is the temperature in Farenheit:" << fahr << endl; - return 0; + + } + return 0; }
\ No newline at end of file |