#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
	case 1:cout<<"You have chosen a single phase power supply\n";
	case 2:cout<<"You have chosen a three phase power supply\n";
	default:cout<<"Invalid choice please try agin\n";
	cout<<"Please enter the value of I\n";//the value of the load current
	cout<<"Please enter the value of V\n";//the value of the input volatge
	cout<<"Please enter the value of F\n";//the frequency
	cout<<"Please enter the value of the power factor\n";//the power factor
		cout<<"Ib in Single phase is\n" << setprecision(4)
		cout<<"Ib in Three phase is\n" << setprecision(4)

	return 0;

Edited 6 Years Ago by WaltP: Added CODE tags -- with all the help about them, how could you miss using them????

tried it out but it displays the current in single phase when i need the current in 3 phase

1) = means "assign the following value". ==, which is what you should almost always be using in the parentheses part of if statements, means "equivalent to" and is used for comparisons.

2) When the code following your if (but before your else) statement consists of more than 1 line, those lines of code must be contained in curly braces (not the actual if line, just the lines following it). The same applies to the code after your else statement.

This article has been dead for over six months. Start a new discussion instead.