ok well im making a mock atm machine (maybe i got the same book as that other guy?)

but im getting an error code " E2294 structure required on left side of . or .* in function main() "

this is puzzling me . can anyone help please?

heres my code

//HEADER FILE

#include <iostream.h>
#include <string.h>

class Account
{
  public:
  Account();
  void getBalance();
  int checkId(int,int);
  void withDraw();
  void deposit();

  private:
  float balance; //account balance
};
// CLASS FILE


#include <iostream.h>
#include <string.h>

#include "Account.h"

Account::Account()
{
}

int Account::checkId(aN,Pw)
{

  return 1;
}

void Account::getBalance()
{
}

void Account::withDraw()
{
}

void Account::deposit()
{
}
// MAIN


#include <iostream.h>
#include <string.h>

#include "Account.h"

int main()
{
  Account account1();
  int verified=0;

  // welcome message and account/password verification
  cout << "\n\n||| ||  |   Welcome to R Savage Bank   |  || |||";
  cout << "\n\nplease enter verification details\n";
  cout << "\naccount number: ";
  int aNumber; // entered account number
  cin >> aNumber;
  cout << "\npassword: ";
  int pWord; // entered password
  cin >> pWord;
  cout << "\n\nvalidating details..";

  verified = account1.checkId(aNumber,pWord);

  return 0;
}

<< moderator edit: added [code][/code] tags >>

any help is muchly appriciated.

#include <iostream>
#include <string> 
 
using namespace std;
 
class Account {
	 public:
			 Account(): balance(0.0) {};
			 inline bool checkpass(string number, string password) {
					// some way to check number and pass
					return 1;
			 }
			 inline float GetBalance() { return balance; };
			 // and so on ...
	 private:
			 float balance;
};
 
int main(void) {
	Account Account1;
	string num, pass;
 
	cout << "\n Input account number: ";
	cin >> num;
	cout << "\n Input password: ";
	cin >> pass;
 
	if(Account1.checkpass(num, pass))
			  cout << "\n Login successful!\n";
	else
			  cout << "\n Error, try again!\n"; // you'll never see this :-)
 
	return 0;
}

This is some equivalent to your code. The division in files I leave to you. ;) Be careful how you initialize an object of the class and how you call a member function through it. This is where your error comes from.

thanks both of you .. i looked in the faq and deicded to take the () off Account account1();


and it worked . i dont know why it worked though which is a bt worrying.

thank :)

It worked because the first is a function declaration and the second is a default constructor call.

look at this ....

int func();

That is obviously a prototype for a function called func that takes no arguments and returns an int. So knowing that you should be able to know what this is....

Account account1();

That declares a function called account1 that takes no arguments and returns an Account object by value. Obviously this isn't what you intended.

ah thank you . i lift my hat to you sir.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.