#include <iostream>
#include <iomanip>
#include <string>
#include <ios>
using std::string;
using std::streamsize;
using std::setprecision;
using namespace std;
int main()
{
double Ib,I,V,P,F,pf,In;
unsigned short int type;
cout<<"Please select the type of power supply\n";//Allows the user to choose between single or three phase
cin>>type;
switch(type)
{
case 1:cout<<"You have chosen a single phase power supply\n";
break;
case 2:cout<<"You have chosen a three phase power supply\n";
break;
default:cout<<"Invalid choice please try agin\n";
break;
}
cout<<"Please enter the value of I\n";//the value of the load current
cin>>I;
cout<<"Please enter the value of V\n";//the value of the input volatge
cin>>V;
cout<<"Please enter the value of F\n";//the frequency
cin>>F;
cout<<"Please enter the value of the power factor\n";//the power factor
cin>>pf;
if(type=1)
{
cout<<"Ib in Single phase is\n" << setprecision(4)
<<(V*I)/V/I/pf
<<setprecision(4)<<endl;
else
cout<<"Ib in Three phase is\n" << setprecision(4)
<<(V*I)/(1.732*V*pf)
<<setprecision(4)<<endl;
}
return 0;
}
Bart_sg 0 Newbie Poster
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
Bart_sg 0 Newbie Poster
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
Mikstaslaya 0 Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.