Im trying to make a C++ program to calculate the resistance in a parallel electric circuit. The formula is
Total = 1 / (1/resistor1)+ (1/resistor2).... + (1/resistorN)
I have made the program however when I compile it it has the "linker error"
Can you please help me spot the mistake
#include <iostream>
using namespace std;
int RParallel(int);
int main()
{
int input[5]; // asign 4 inputted numbers to int
cout << "This Program will calculates total resistance"
<< "\nin a parallel electric circuit "
<< endl; // description of program
cout << "\nPlease enter 5 resistors separated by space: " ;
// asign inputted numbers
cin >> input[1] >> input[2] >> input[3] >> input[4] >> input[5];
RParallel( input[5] ); // calls the funtion
system("pause");
return 0;
}
int RParallel( int input[5] )
{
int N, temp, total;
total = 0;
for (N = 1; N <=5; N++)
{
temp = 1/(1/input[N]);
total += temp;
}
cout << "\n\nThe Resistant total is : " << total << endl << endl ;
return total;
}