![]() |
|
#1
|
||||
|
||||
printing an enumeration .Given the definition :
CPP / C++ / C Code:
What would be the appropriate way to print the enumeration itself (not the number that represents each value) ? Is it possible without a switch ? Kobi. |
|
#2
|
||||
|
||||
|
To answer your second question: yes, it is possible without switch, by using if-else.
Okay, not that funny. But, of course, this means that the answer to your first question is: by using some conditinoal statements, like switch or if-else. Unfortunately, those are your choices. (As far as I know, of course.) Matthew |
|
#3
|
|||
|
|||
|
Some disgusting macro trickery:
http://cboard.cprogramming.com/showt...539#post186539 |
|
#4
|
||||
|
||||
|
Quote:
Not nice, making fun of me :-( Kobi. |
|
#5
|
||||
|
||||
|
Quote:
Matthew |
|
#6
|
||||
|
||||
|
Quote:
Matthew |
|
#7
|
|||
|
|||
|
Quote:
CPP / C++ / C Code:
|
|
#8
|
||||
|
||||
|
Quote:
Got it. I have rarely used macros, so I don't typically think in that way. Very good little technique to know, should I ever need or want to do such a thing. Fortunately, I never have. Matthew Edit: I take that back. I have done a similar thing, but in Java and the maintenance (since there are no macros) is annoying. |
|
#9
|
||||
|
||||
I know :-)Quote:
I wouldn't think anything else. |
|
#10
|
||||
|
||||
About macrosQuote:
I recently started using macros (again, in my neverending assembler project) and found that they can dramatically improve program performance and sometimes even provide away to write "generic" code much faster. Kobi. |
Recent GIDBlog
Developing GUIs with wxPython (Part 3) by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Printing problems--->ARG! | toddm123 | .NET Forum | 0 | 31-Mar-2005 12:51 |
| printing format | stacy12 | C Programming Language | 1 | 30-Mar-2005 01:14 |
| printing binary search tree | nkhambal | C Programming Language | 2 | 26-Mar-2005 03:01 |
| problem printing output | iamsodumb | C++ Forum | 4 | 10-Mar-2005 13:19 |
| printing integers in graphics mode | enggwaqas | C Programming Language | 4 | 04-Oct-2004 20:47 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The