Hello everyone.
In the following code, I get a C2296 error when I try to compile in VC++ 6.0. The error reads: error C2296: '/' : illegal, left operand has type 'double [10]'. I have tried to find a solution, but I do not understand why this happens. I have never had this problem before. If anyone has suggestions, I would appreciate the help.
Here is the code:
Code:
#include <iostream>
#include <iomanip>
#include <fstream>
#include <cmath>
void mortgageCalc();
using namespace std;
int main()
{
void mortgageCalc();
return 0;
}
//******************
void mortgageCalc()
{
const int MAX_SIZE=10;
int index=0; //account record
int total=0;
int loan[MAX_SIZE];
int month[MAX_SIZE];
double rate[MAX_SIZE];
double monthlyPayment;
double totalPayment;
double ratem;
double expm;
ifstream inFile;
inFile.open("mortgage.txt"); //get txt file
if (!inFile.fail())
{
cout<< setiosflags(ios::fixed | ios::showpoint)
<< setprecision (2);
cout<<endl;
ratem=rate / 1200.0;
expm=(1.0 + ratem);
monthlyPayment=(ratem*pow(expm,month)*loan) / (pow(expm,month)-1.0);
totalPayment= monthlyPayment*month
cout<<"\t Here are the mortgage loan calculations for"<<endl;
cout<<"\t the following accounts: "<<endl;
cout<<endl;
while (!inFile.eof() && index < MAX_SIZE)
{
//import record
inFile>>loan[index]>>month[index]>>rate[index];
index++;
}
for (index=0; index < MAX_SIZE; index++)
{
cout<<"Account Number "<<index<<" borrowed $ "<<loan<<endl;
cout<<"The monthly payment for this account is $"<<monthlyPayment<<endl;
cout<<"The total payment amount for the loan is $"<<totalPayment<<end;
cout<<endl;
cout<<endl;
}
}
else
{
cout << "File not read"<< endl;
}
} //end of function