No operator ">>" matches these operands

Hello,

I am tring to add a new customer for a bank with a function. And the error "No operator ">>" matches these operands" occured when i try to get the zip code(long), account number (long), and balance (float) with cin.

The function looks like this

void customer::add_info()
{
cout << "Please enter the customer name:\t";
getline(cin, get_name());
cout << "\nPlease enter the customer's address: \t";
getline(cin, get_address());
cout << "\nPlease enter the state: \t";
cin >> get_state();
cout << "\nPlease enter the zip code: \t";
cin >> get_zip();
cin.ignore(10, '\n');
cout << "\nPlease enter the city: \t";
getline (cin, get_city());
cout << "\nPlease enter the account number: \t";
cin >> get_acc();
cout << "\nPlease enter the balance: \t";
cin >> get_balance();
}

And this is how my class looks like
#ifndef read_info_H
#define read_info_H

#include <iostream>
#include <fstream>
#include <string>
using namespace std;

class customer{
private:
string name, address, state, city;
long zip, acc;
float balance;
int withdraw, deposit;
public:
customer();
void set_info(ifstream &);
string get_name();
string get_address();
string get_state();
string get_city();
long get_zip();
long get_acc();
int get_withdraw();
void set_withdraw();
int get_deposit();
void set_deposit();
float get_balance();
void add_info();
void print_info();
};
#endif

Thanks for helping me.
Last edited on
cin >> get_zip(); \\error here
should be
cin >> zip;

get_zip() is a function. zip is a variable. You use the >> operator to put values into variables.
Thank you very much. That solved the problem.
Topic archived. No new replies allowed.