Program to Calculate Inductive & Capacitive Reactance
#include <iostream.h>
#include <conio.h>
const
double pi=3.1416;
int
main()
{
cout<<"Which
of the following you want to calculate first? \n 1- Capacitive Reactance \n
2-Inductive Reactance \n \n";
cout<<"Enter
the index number: ";
char
cap;
cin>>cap;
switch(cap)
{
case
'1':
cout<<"Forumla
is Xc=2piFC \n \n";
cout<<"Enter
the values of F and C: ";
float
F,C,Xc;
cin>>F>>C;
Xc=1/(2*pi*F*C);
cout<<"Xc=
"<<Xc<<"\n \n";
break;
default:
("Unknown");
}
cout<<"Enter
the Index number of Second Formula: ";
char
Induc;
cin>>Induc;
switch(Induc)
{
case
'2':
cout<<"Forumla
is XL=2piFL \n";
cout<<"Enter
the values of F and L: ";
float
L,XL,F2;
cin>>F2>>L;
XL=2*pi*F2*L;
cout<<"XL=
"<<XL<<"\n";
break;
default:
("Unknown Choice");
}
getch();
return
0;
}
No comments :
Post a Comment