Guest User

Untitled

a guest
Dec 17th, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.20 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. #include <iomanip>
  4. #include <fstream>
  5. #include <math.h>
  6.  
  7. using namespace std;
  8. int main()
  9. {
  10.     // Declare Necessary Variables
  11.  
  12.     float Vot = 0;
  13.     float Vi = 0;
  14.     float e = 0;
  15.     float Voe = 0;
  16.     char a = 0;
  17.  
  18.  
  19. do {
  20.     cout << "Measured Input  Voltage = " << Vi << endl << "Measured Output Voltage = " << Voe << endl << "Error Rate = " << e << endl << "Result = " << Vot << endl << endl << endl << endl;
  21.     cout << "(I) Change Input Voltage " << endl << "(O) Change Output Voltage" << endl << "(E) Exit " << endl << endl;
  22.     cout << "Choose option" << endl;
  23.     cin >> a;
  24.  
  25.  
  26. switch ( a )
  27.       {
  28.          case 'I':
  29.          system("CLS");
  30.          cout << "Input Voltage = ";
  31.          cin >> Vi;
  32.          break;
  33.          case 'i':
  34.          system("CLS");
  35.          cout << "Input Voltage = ";
  36.          cin >> Vi;
  37.          break;
  38.          case 'O':
  39.          system("CLS");
  40.          cout << "Output Voltage = ";
  41.          cin >> Voe;
  42.          break;
  43.          case 'o':
  44.          system("CLS");
  45.          cout << "Output Voltage = ";
  46.          cin >> Voe;
  47.          break;
  48.          default:
  49.           break;  
  50.       }
  51.     Vot = 10 - 5 * (pow( Vi - 1.5, 2));
  52.     e = ((Voe-Vot)/Vot)*100;
  53. system("CLS");
  54. }while ( a != 'E' && a != 'e');
  55.  
  56.  
  57. }
Add Comment
Please, Sign In to add comment