Can someone show me how to cancel enter Y to do an other calculation on this program then can you show me how to calculate the resonant frequency
The resonant frequency is when XL-Xc = 0
thank you
CODE
#include<iostream>
using namespace std;
#define pi 3.142
#include <math.h>
#include <iomanip>
void ShowTitle();
void GetData();
void DoCalcs_ShowResults();
double capacitor=0;
double inductor=0;
double resistor=0;
double frequency=0;
double impedance=0;
double reactance=0;
double phase_angle=0;
char letter = 'Y';
void main()
{
cout<<"\nFunprog 1 A modular program using Global values"<<endl;
do
{
ShowTitle();
GetData();
DoCalcs_ShowResults();
cout<<"\n\npress Y then Enter to do another calculation,"<<"\n\n\t\tOR";
cout<<"\n\npress any other key then Enter to terminate";
cin>>letter;
}
while(letter == 'Y' || letter == 'Y');
}
void ShowTitle()
{
cout<<"\n R/C/L Series circuit calculation"<<endl;
}
void GetData()
{
cout<<"\nEnter Capacitor value in micro farads:";
cin>>capacitor;
cout<<"\nEnter Resistor value in ohms:";
cin>>resistor;
cout<<"\nEnter inductor value in henrys:";
cin>>inductor;
cout<< setw(10) << "\n\n\t\t\tReactance (ohms)\tImpedance (ohms)\tPhase Angle(Deg)\n"<<endl;
}
void DoCalcs_ShowResults()
{
for(frequency=10;frequency<=100;frequency+=10);
{
cout<<setw(10) << setiosflags(ios::fixed) << setprecision(0)<<"\n For Frequency = "<<frequency<<"HZ";
reactance = 1000000/(2*pi*frequency*capacitor)+(2*pi*frequency*inductor);
impedance = sqrt (pow(resistor,2) + pow(reactance,2));
phase_angle = atan(reactance / resistor)*(180/pi);
cout<<"\t" <<setw(10) << setiosflags(ios::fixed) << setprecision(2)<<reactance;
cout<<"\t" <<setw(10) <<setiosflags(ios::fixed) << setprecision(2)<<impedance;
cout<<"\t" <<setw(10) <<setiosflags(ios::fixed) << setprecision(2)<<phase_angle;
cout<<"\n";
}
}