#include <iostream>
#include <iomanip>
#include <string>


using namespace std;

int main()
{
double V,I,pf,Ib;
unsigned short int choice;
int In;

cout<<"Please choose power supply type\n";
cin>>choice;

switch(choice)
{
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 Try Again\n";
	break;

}
cout<<"Please enter the value for I\n";
cin>>I;
cout<<"Please enter the value for V\n";
cin>>V;
cout<<"Please enter the value for pf\n";
cin>>pf;

if(choice<2)
{
     Ib=(V*I)/V/pf;//First compute Ib here
	cout << "Ib in single phase is " << setprecision(4)
     << Ib//Then output the value
     << setprecision(4) << endl;
}
else
{
    Ib=(V*I)/(1.732*V*pf);//Compute first
	cout << "Ib in three phase is" << setprecision(4)
     << Ib<<endl//then output
     << setprecision(4) << endl;
}

if (Ib<6){
  In=6;
  }
else {
if (Ib<10) {
In=10;
}
else {
if (Ib<15){
In=15;
}
else {
if (Ib<20){
In=20;
}
else {
if (Ib<25){
In=25;
}
else {
if(Ib<30){
In=30;
}
else{
if(Ib<40){
In=40;
}
else{
if(Ib<50){
In=50;
}
else{
In=100;
}
}
}
}
}
}
}
}
cout<<"In is" << In<< endl;

unsigned short int type;
double Cc;

cout<<"1-Are cables buried underground? Hit 1 if so\n";
cout<<"2-Are your portected by a BS 3036 fuse? Hit 2 if so\n";
cout<<"3-Are your cables protected by a BS 3036 fuse and buried underground? Hit 3 if so\n";
cout<<"4-None of the above mentioned\n\n";
cin>>type;
switch(type)
{ 
case 1:cout<<"Your cables buried underground\n";
	break;
case 2:cout<<"Your cables are protected by a BS 3036 fuse\n";
	break;
case 3:cout<<"Cables protected by a BS 3036 fuse and buried underground\n";
	break;
case 4:cout<<"Cables are not portected by 3036 fuse and not buried\n";
	break;
}

if(type==1)
{
	Cc=0.9;
}
else 
{
	if(type==2)
	{
		Cc=0.725;
	}
	else
	{
		if(type==3)
		{
			Cc=0.6525;
		}
		else 
		{
			Cc=1;
		}
	}
}

			
		
cout<<"Cc is" << Cc << endl;
unsigned short int Ans;
double Ci;
cout<<"1-Are your Cables completely surrounded by insulating material?\n";
cout<<"2-if not press 2\n";
cin>>Ans;
switch(Ans)
{
case 1:cout<<"Cables are surrounded by insulating material\n";
	   break;
case 2:cout<<"Cables are not surrounded by insulating material\n";
	   break;
}
if(Ans==1)
{
	Ci=0.5;
}
else
{
	Ci=1;
}
int AT;
cout<<"Please enter the Ambient temperature\n";
cin>>AT;

unsigned short int Cabletype;

cout<<"Please choose the type of cables you intend to use\n";
cout<<"1 Single-core amoured, with or without sheath(Thermosetting 70)\n";
cout<<"2 Multicore non amoured(Thermosetting 70)\n";
cout<<"3 Single-core amoured(Thermosetting 70)\n";
cout<<"4 Multicore amoured(Thermosetting 70)\n";
cout<<"5 Flat cable with protective conductor(Thermosetting 70)\n";
cout<<"6 Single-core amoured, with or without sheath(Thermosetting 90)\n";
cout<<"7 Multicore non amoured(Thermosetting 90)\n";
cout<<"8 Single-core amoured(Thermosetting 90)\n";
cout<<"9 Multicore amoured(Thermosetting 90)\n";
cin>>Cabletype;

switch(Cabletype)
{ 
case 1:cout<<"Single-core amoured, with or without sheath(Thermosetting 70)\n";
	break;
case 2:cout<<"Multicore non amoured(Thermosetting 70)\n";
	break;
case 3:cout<<"Single-core amoured(Thermosetting 70)\n";
	break;
case 4:cout<<"Multicore amoured(Thermosetting 70)\n";
	break;
case 5:cout<<"Flat cable with protective conductor(Thermosetting 70)\n";
	break;
case 6:cout<<"Single-core amoured, with or without sheath(Thermosetting 90)\n";
	break;
case 7:cout<<"Multicore non amoured(Thermosetting 90)\n";
	break;
case 8:cout<<"Single-core amoured(Thermosetting 90)\n";
	break;
case 9:cout<<"Multicore amoured(Thermosetting 90)\n";
	break;
}

double Ca1[10];
double Ca2[14];
double Ca3[10];
double Ca4[14];

double Ca1[10]={1,2,3,4,5,6,7,8,9,0};

 
return 0;
}

Hi im new to C++, i've tried creating an array but evrytime i build the solution it replies with this error message (error C2086: 'double Ca1[10]' : redefinition) could anyone offer some help?

Recommended Answers

All 2 Replies

Lines 198 and 203. You cannot declare the same variable twice. Try deleting line 198.

Also try formatting your code. With code this large, your inconsistent formatting makes the program almost impossible to follow.

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.