Thread: How can I start this,,,,please tell me any comment

  1. #1
    Registered User
    Join Date
    Apr 2002
    Posts
    2

    Talking How can I start this,,,,please tell me any comment

    Define a C++ class Employee with three private data members:name(char*), salary(int), and SSN(short). The Employee class should have two constructors: one with no argument that sets name to NULL and salary and SSN to zero, and one with a string(char*) argument which sets name to point to the string argument and sets salary and SSN to zero. Define a public member function in the Employee class that prints out the name and salary of an employee.
    ->This is the question
    Could u tell me what do u recommend to start to write this,
    then I can figure it out the rest of the program ^^
    help me~!!!

  2. #2
    Registered User Zeeshan's Avatar
    Join Date
    Oct 2001
    Location
    London, United Kingdom
    Posts
    226
    class Employee {
    public:
    Employee();
    Employee(char* nm);
    void DisplayInfo(void);
    ~Employee();
    private:
    char *name;
    int salary;
    short SSN;
    };

    Employee::Employee()
    {
    name=NULL;
    salary=SSN=0;
    }

    Employee::Employee(char* nm)
    {
    strcpy(name,nm);
    salary=SSN=0;
    }


    void Employee:isplayInfo(void)
    {
    printf("\n%s %d",name,salary);
    }

    Employee::~Employee()
    {}



    how's that ?

  3. #3
    Me want cookie! Monster's Avatar
    Join Date
    Dec 2001
    Posts
    680

    Re: How can I start this,,,,please tell me any comment

    Originally posted by samidang
    Define a C++ class Employee
    If you have a C++ question then post it in the C++ forum and not the C forum.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. GNOME Desktop won't start (Mandriva)
    By psychopath in forum Tech Board
    Replies: 10
    Last Post: 07-19-2006, 01:21 PM
  2. WHEN to start game programming
    By mrcheesypants in forum Game Programming
    Replies: 18
    Last Post: 02-02-2006, 04:09 PM
  3. Need help from experts to start game programming
    By cader in forum Game Programming
    Replies: 8
    Last Post: 11-29-2005, 12:48 PM
  4. cannot start a parameter declaration
    By Dark Nemesis in forum C++ Programming
    Replies: 6
    Last Post: 09-23-2005, 02:09 PM
  5. Need some help with a basic tic tac toe game
    By darkshadow in forum C Programming
    Replies: 1
    Last Post: 05-12-2002, 04:21 PM