2 Replies - 934 Views - Last Post: 11 November 2010 - 06:08 PM Rate Topic: -----

#1 Guest_mwmnj*


Reputation:

"no math for 'operator'" error?

Posted 11 November 2010 - 06:04 PM

I am completely confused as to what could be causing this error? I feel like i've tried everything!
The error is occuring in my input module. I will post that first and comment out the line that has the error. Then I'll post my header file and my main module just in case the root of the problem is found in either of them.

Anyone familiar with this "no match for 'operator>>'" error???

INPUT MODULE
#include <iostream>
#include "header.h"
using namespace std;

void input (int & accountNumber, char & accountType, float & minimumBalance, float & currentBalance)

{
   cout << "enter account number, account type, minimum balance, and current balance." << endl;

//ERROR ----->   cin >> accountNumber >> accountType >> minimumBalance >> currentBalance >> endl;
 
 do
    {
         if (!cin);
         cout << "Account must be a 5 digit integer (i.e. 10000 thru 99999)" << endl;
         cout << "Account type must be (c, C, s or S)"  << endl;
         cout << "Minimum balance must be greater than or equal to 1000" << endl;
         cout << "Ending balance must be non-negative" << endl;

    }
    while (cin == 1);
    
}



MAIN MODULE
#include "header.h"

int main ()
{
   
    float minimumBalance, currentBalance, endBalance; 

    char accountType, response; 
    
    int accountNumber;
          
     do
      { 
           input (accountNumber, accountType, minimumBalance, currentBalance);
           cout << "\nAny more accounts? (y,n) ";
           cin >> response;
      }          
    while (response == 'Y' || response == 'y');
    
    calculate (accountType, minimumBalance, currentBalance, endBalance);
    myLabel ("pretest 1", "11/9/2010");   
    output (accountType, minimumBalance, currentBalance, endBalance);
    system ("Pause");

    return 0;
    
}    



HEADER FILE
#ifndef header_h
#define header_h

#include <iostream>
#include <iomanip>
#include <cstdlib>

using namespace std;

      //Named constants 
const float S_RATE = .04;
const float S_CHARGE = 10.00;
const float C_RATE1 = .05;
const float C_RATE2 = .03;
const float C_CHARGE = 25.00;


void extern input(int&, char&, float&, float&);
void extern calculate(char, float, float, float&);
void extern output (char, float, float, float);
void extern myLabel(const char *, const char *);

#endif



If anyone could help it would be greatly appreciated! thanks!

Is This A Good Question/Topic? 0

Replies To: "no math for 'operator'" error?

#2 KYA   User is offline

  • Wubba lubba dub dub!
  • member icon

Reputation: 3213
  • View blog
  • Posts: 19,241
  • Joined: 14-September 07

Re: "no math for 'operator'" error?

Posted 11 November 2010 - 06:07 PM

endl is for cout not cin
Was This Post Helpful? 0
  • +
  • -

#3 mwmnj   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 7
  • Joined: 02-October 10

Re: "no math for 'operator'" error?

Posted 11 November 2010 - 06:08 PM

Solution found! cant use endl; with cin >>
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1