I need help on this problem using classes and arrays

This is a discussion on I need help on this problem using classes and arrays within the C++ Programming forums, part of the General Programming Boards category; You seem to be very fond of using floating point variables... I know this won't actually solve the "real" problem, ...

  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
    Posts
    23,025
    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
    Registered User whiteflags's Avatar
    Join Date
    Apr 2006
    Location
    United States
    Posts
    7,762
    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
    32,852
    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.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

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

Page 2 of 2 FirstFirst 12
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, 03: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, 12:54 PM
  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, 10:40 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21