Guest User

Untitled

a guest
Jan 21st, 2018
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.57 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5.  
  6. int main()
  7. {
  8.  
  9.     float a;
  10.     float c;
  11.     int d = 32;
  12.     int result;
  13.     float e = (9/5);
  14.     float f = (5/9);
  15.  
  16.     cout << "What are you trying to convert?\n 1.Fahrenheit\n 2.Celsius\n";
  17.     cin >>  a;
  18.     cout << "What is the value?\n";
  19.  
  20.     if (a == 1)
  21.     {
  22.         cin >> c;
  23.         result = (c - 32) * 5 / 9;
  24.         cout << result;
  25.     }
  26.  
  27.     else if (a == 2)
  28.     {
  29.         cin >> c;
  30.         result = c * 9 / 5 + 32;
  31.         cout << result;
  32.     }
  33.  
  34.     else
  35.     {
  36.         cout << "Please enter a valid choice";
  37.     }
  38.  
  39.     return 0;
  40. }
Add Comment
Please, Sign In to add comment