Thread: Help finding solution to illegal operator

  1. #1
    Registered User
    Join Date
    Jun 2004

    Help finding solution to illegal operator

    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:

    #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; 
   "mortgage.txt");            //get txt file
        if (!					
            cout<< setiosflags(ios::fixed | ios::showpoint)
    	       << setprecision (2);
           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;
          while (!inFile.eof() && index < MAX_SIZE)
    											//import record
          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 << "File not read"<< endl;
    }										//end of function

  2. #2
    & the hat of GPL slaying Thantos's Avatar
    Join Date
    Sep 2001
    int loan[MAX_SIZE];
    /* ... */
    monthlyPayment=(ratem*pow(expm,month)*loan) / (pow(expm,month)-1.0);
    You need to specify a particular element from the array to use in the equation.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. C++ Operator Overloading help
    By Bartosz in forum C++ Programming
    Replies: 2
    Last Post: 08-17-2005, 12:55 PM
  2. class initialization and the = operator
    By krygen in forum C++ Programming
    Replies: 3
    Last Post: 01-27-2005, 12:44 AM
  3. Destructor - Execution problem
    By triste in forum C++ Programming
    Replies: 16
    Last Post: 09-26-2004, 01:57 PM
  4. quick c++ operator question
    By pkananen in forum C++ Programming
    Replies: 3
    Last Post: 12-11-2001, 06:46 PM
  5. int vs BIG INT
    By rumi_red in forum C++ Programming
    Replies: 1
    Last Post: 10-30-2001, 04:15 AM