Advertisement
popcheese9

multiTool

Feb 7th, 2017
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.61 KB | None | 0 0
  1. //multiTool.cpp
  2. #pragma once
  3. #include <iostream>
  4. #include <math.h>
  5. #include "multiTool.h"
  6.  
  7. using namespace std;
  8.  
  9. int main()
  10. {
  11.     int Q1;
  12.     cout << "Input number corresponding to operation" << endl;
  13.     cout << "1. Quadratic Calculator" << endl;
  14.     cout << "2. Coordinate Distance and Midpoint Calculator" << endl;
  15.     cout << "3. Celsius to Fahrenheit" << endl;
  16.     cout << "4. Fahrenheit to Celsius" << endl;
  17.     cin >> Q1;
  18.  
  19.     switch(Q1)
  20.     {
  21.         case 1:
  22.             quadCalc();
  23.         case 2:
  24.             coordDistCalc();
  25.         case 3:
  26.             celToFahr();
  27.         case 4:
  28.             fahrToCel();
  29.     }
  30.  
  31. #pragma region quadCalc
  32.     void quadCalc()
  33.     {
  34.         double a, b, c, A1, A2, X1, X2;
  35.  
  36.         cout << "Input value for a: ";
  37.         cin >> a;
  38.         cout << "Input value for b: ";
  39.         cin >> b;
  40.         cout << "Input value for c: ";
  41.         cin >> c;
  42.  
  43.         A1 = (b*b)-(4*a*c);
  44.         A2 = sqrt(A1);
  45.         X1 = ((-(b)) + A2)/(2*a);
  46.         X2 = ((-(b)) - A2)/(2*a);
  47.  
  48.         cout << "The answer is x= " + X1 + ", " + X2 << endl;
  49.         System("PAUSE");
  50.     }
  51. #pragma endregion quadCalc
  52.  
  53. #pragma region coordDistCalc
  54.     void coordDistCalc()
  55.     {
  56.  
  57.     }
  58. #pragma endregion
  59.  
  60. #pragma region celToFahr
  61.     void celToFahr()
  62.     {
  63.         double Q1, A1, A2;
  64.  
  65.         cout << "Input temperature to be changed to Fahrenheit: ";
  66.         cin >> Q1;
  67.  
  68.         A1 = ((Q1*9)/5);
  69.         A2 = A1+32;
  70.  
  71.         cout << Q1 + "C in Fahrenheit is: " + A2 << endl;
  72.         System("PAUSE");
  73.     }
  74. #pragma endregion
  75.  
  76. #pragma region fahrToCel
  77.     void fahrToCel()
  78.     {
  79.         double Q1, A1, A2;
  80.  
  81.         cout << "Input temperature to be changed to Celsius: ";
  82.         cin >> Q1;
  83.  
  84.         A1 = ((Q1-32)*5);
  85.         A2 = A1/9;
  86.  
  87.         cout << Q1 + "F in Celsius is: " + A2 << endl;
  88.         System("PAUSE");
  89.     }
  90. #pragma endregion
  91. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement