enum

This is a discussion on enum within the C++ Programming forums, part of the General Programming Boards category; Maybe the instructor is thinking of Java enums? Enum Types (The Java™ Tutorials > Learning the Java Language > Classes ...

  1. #16
    Registered User
    Join Date
    May 2008
    Posts
    87
    Maybe the instructor is thinking of Java enums?
    Enum Types (The Java™ Tutorials > Learning the Java Language > Classes and Objects)
    Java programming language enum types are much more powerful than their counterparts in other languages. The enum declaration defines a class (called an enum type). The enum class body can include methods and other fields.
    As far as C++ goes, I would think a std::map would work here (assignment requirements aside). A map stores (key, value) pairs. You can look up a value based on its key. In this case, student names or perhaps a student data type would be the value, and the student number would be the key.
    map - C++ Reference

  2. #17
    Registered User
    Join Date
    May 2009
    Posts
    106
    Quote Originally Posted by jason_m View Post
    Maybe the instructor is thinking of Java enums?
    Enum Types (The Java™ Tutorials > Learning the Java Language > Classes and Objects)


    As far as C++ goes, I would think a std::map would work here (assignment requirements aside). A map stores (key, value) pairs. You can look up a value based on its key. In this case, student names or perhaps a student data type would be the value, and the student number would be the key.
    map - C++ Reference
    I 100% agree

Page 2 of 2 FirstFirst 12
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. enum [tag] [: type] Is this non-standard?
    By HyperShadow in forum C++ Programming
    Replies: 2
    Last Post: 12-09-2007, 10:29 PM
  2. enum switchcase and windows message q
    By kryptkat in forum Windows Programming
    Replies: 7
    Last Post: 11-27-2006, 01:16 PM
  3. Conflicting enum issue
    By 7force in forum C Programming
    Replies: 1
    Last Post: 07-05-2006, 04:51 AM
  4. Switch case and enum help
    By SomeCrazyGuy in forum C++ Programming
    Replies: 9
    Last Post: 04-21-2005, 09:53 PM
  5. enum
    By JerryL in forum C++ Programming
    Replies: 5
    Last Post: 02-25-2004, 05:45 PM

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