enums!

This is a discussion on enums! within the C Programming forums, part of the General Programming Boards category; Hi, I have to do this C question involving enum's which I don't understand the point of. I have to ...

  1. #1
    Registered User
    Join Date
    Nov 2001
    Posts
    5

    enums!

    Hi,

    I have to do this C question involving enum's which I don't understand the point of.

    I have to write an array, subscripted by a suitable enumerated type for a student who works at a burger place. They have to input their own hours for each day of the week, and afterwards calculate their wage and longest day based on the fact that they get paid $4 an hour during the week and $5 at the weekends.

    I could do this using an array alone, but im not allowed too... have to use an enum, can someone please help me???

    Thanks!

    J

  2. #2
    ....
    Join Date
    Aug 2001
    Location
    Groningen (NL)
    Posts
    2,386
    >I could do this using an array alone, but im not allowed too...
    >have to use an enum,

    I think you don't quite understand the differences between an enummeration and an array. An array is a piece of memory in which you can store elements and each element can be retrieved by its index. An enummeration is a number of constants. But you can do something like this:

    Code:
    typedef enum
    {
        FALSE,
        TRUE
    } boolean_e;
    
    boolean_e array [NR_OF_ELEMENTS];

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Serialization of Enums
    By khdani in forum C# Programming
    Replies: 1
    Last Post: 04-27-2009, 10:57 AM
  2. Replies: 23
    Last Post: 07-09-2007, 04:49 AM
  3. Enums and Templates
    By einarp in forum C++ Programming
    Replies: 5
    Last Post: 07-19-2006, 05:07 AM
  4. Tricking enums
    By Ganoosh in forum C++ Programming
    Replies: 3
    Last Post: 01-07-2006, 01:46 PM
  5. printing enums
    By xddxogm3 in forum C++ Programming
    Replies: 19
    Last Post: 08-09-2005, 12:08 PM

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