summaryrefslogtreecommitdiff
path: root/BlankConsoleLab
diff options
context:
space:
mode:
authoralexandra-apetroaei <andra@MSI>2022-10-29 10:12:53 -0800
committeralexandra-apetroaei <andra@MSI>2022-10-29 10:12:53 -0800
commitf82c65b56436816eedbb10048fba141061e8cd8f (patch)
treefe7c454b1040e1dd90db3df6a4ce3a033aa5286f /BlankConsoleLab
parentfirst step (diff)
downloadcst116-lab2-alexandra-apetroaei-master.tar.xz
cst116-lab2-alexandra-apetroaei-master.zip
Diffstat (limited to 'BlankConsoleLab')
-rw-r--r--BlankConsoleLab/Project2-Apetroaei.cpp39
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