Thread: I need help on this problem using classes and arrays

  1. #16
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    You seem to be very fond of using floating point variables...

    I know this won't actually solve the "real" problem, but surely an employee id is not a double? If they are, who is employe id 3.1415926...?

    Likewise
    Code:
    	double a, b,d,e,f,g;
    ...
    	cout<<"1. Add an employee"<<endl;
    	cout<<"2. Modify employee data"<<endl;
    	cout<<"3. Delete an employee"<<endl;
    	cout<<"4. Exit this menu"<<endl;
    	cin>>d;
    Are you planning on having options 1.2, 1.3, 1.8 and 2.5 as well? Otherwise either an integer or a char will do fine here (int will be less changes to the code below).

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  2. #17
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    Quote Originally Posted by john5754 View Post
    I don't know how to do that what does the syntax look like?
    What syntax? Syntax for what?
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  3. #18
    Registered User
    Join Date
    Nov 2008
    Posts
    18
    I still don't know what to do. How should I change my code to to make it work?

  4. #19
    Lurking whiteflags's Avatar
    Join Date
    Apr 2006
    Location
    United States
    Posts
    9,612
    Write out your Employee class, keep it simple.

    Write the program that you were supposed to test it with as homework.

    Then write the other menu driven program. If it were me in your shoes, I would just shove Employee into a std::vector (look it up on the internet) and get the options working.

    I really don't know where a multidimensional array fits in, sorry. You'll have to ask your professor about it. I'm assuming that the multidimensional array is optional as a suggestion, and not something your professor wants you to do.

  5. #20
    Registered User
    Join Date
    Nov 2008
    Posts
    18
    I'm still lost I dont know what to type

  6. #21
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    What does your latest code look like?
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  7. #22
    Registered User
    Join Date
    Nov 2008
    Posts
    18
    Its still the same thing on page 1

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. problem in classes and arrays
    By hiya in forum C++ Programming
    Replies: 15
    Last Post: 04-09-2005, 02:45 PM
  2. Problem with classes and Arrays
    By GonzO86 in forum C++ Programming
    Replies: 4
    Last Post: 03-02-2005, 04:35 PM
  3. Arrays with base/derived classes
    By shaeng in forum C++ Programming
    Replies: 3
    Last Post: 05-31-2004, 11:54 AM
  4. Problem with character arrays in classes
    By spoketoosoon in forum C++ Programming
    Replies: 3
    Last Post: 03-16-2004, 03:57 AM
  5. Help with Arrays of Classes
    By GrNxxDaY in forum C++ Programming
    Replies: 15
    Last Post: 07-25-2002, 09:40 PM