Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- #include <iomanip>
- #include <fstream>
- #include <math.h>
- using namespace std;
- int main()
- {
- // Declare Necessary Variables
- float Vot = 0;
- float Vi = 0;
- float e = 0;
- float Voe = 0;
- char a = 0;
- do {
- cout << "Measured Input Voltage = " << Vi << endl << "Measured Output Voltage = " << Voe << endl << "Error Rate = " << e << endl << "Result = " << Vot << endl << endl << endl << endl;
- cout << "(I) Change Input Voltage " << endl << "(O) Change Output Voltage" << endl << "(E) Exit " << endl << endl;
- cout << "Choose option" << endl;
- cin >> a;
- switch ( a )
- {
- case 'I':
- system("CLS");
- cout << "Input Voltage = ";
- cin >> Vi;
- break;
- case 'i':
- system("CLS");
- cout << "Input Voltage = ";
- cin >> Vi;
- break;
- case 'O':
- system("CLS");
- cout << "Output Voltage = ";
- cin >> Voe;
- break;
- case 'o':
- system("CLS");
- cout << "Output Voltage = ";
- cin >> Voe;
- break;
- default:
- break;
- }
- Vot = 10 - 5 * (pow( Vi - 1.5, 2));
- e = ((Voe-Vot)/Vot)*100;
- system("CLS");
- }while ( a != 'E' && a != 'e');
- }
Add Comment
Please, Sign In to add comment