Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help Please. Newbie at work. Failing.
#1
Hey.
So, I'm new to C++. I thought why not try and get into OOP. I don't think I quite understood how they work.
My program is supposed to work like an ATM machine. First off it should check user input for a name. And that's where I fail already. I just can't get it to work and I have no idea why.
The errors are i.e : ISO C++ forbids initialization of member `Name' ยด; making `Name' static ; invalid in-class initialization of static data member of non-integral type `std:Confusedtring' ;


Code:
#include <cstdlib>
#include <iostream>
#include <string>

using namespace std;


class User
{
      public:
      string Name = 'Bob Kelso' ;
      
      
      string Check(string x)
      {
           string com = Name;
           if ( com == x)
           {
                cout << "You made it. Congratz" << endl;
           }
      }
      
};

int main()
{
    
  string x;
  
  cout << "Enter your name to withdraw money : " ;
  cin >> x;
  cin.ignore();
  
  Check(x);
  
  
  cin.get();
  return 0;
    
}
Thanks in advance Thumbsup
Reply


Messages In This Thread
Help Please. Newbie at work. Failing. - by TheDoctor - 10-07-2009, 12:55 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)