The book im using is the Programming in C++ by D'Orazio
ok my problem is i cant get the function to return the right calculation for p
this is what i have so far
# include <iostream>
# include <cmath>
# include <iomanip>
# include <fstream>
using namespace std;
double power (double,double,double);
int main ()
{
double v,i,p;
int powe;
ifstream Cons ("C:\\POW.DAT");
for (powe =1;powe <=4;powe ++)
{
Cons >> v >> i;
cout<<"Input voltage = "<<v<<" volts,current = "<<i<<" amperes"<<endl;
cout<<"Power consumed by the heater = "<<p<<" watts"<<endl<<endl;
}
system("pause");
return 0;
}
double power (double v,double i, double p)
{