[c17dc80] | 1 | #include <fstream.hfa>
|
---|
| 2 | #include <stdlib.hfa>
|
---|
| 3 | #include <stdio.h>
|
---|
| 4 |
|
---|
| 5 | enum(char *) Colour {
|
---|
| 6 | Red = "red", Green = "green", Blue = "blue"
|
---|
| 7 | };
|
---|
| 8 |
|
---|
| 9 | // enum( signed char ) srgb { Red = -1, Green = 0, Blue = 1 };
|
---|
| 10 |
|
---|
| 11 | enum Plain { A, B, C = 10 };
|
---|
| 12 |
|
---|
| 13 | int main () {
|
---|
| 14 | Colour fishy; // posE()
|
---|
| 15 | fishy = Colour.Green; // value(fishy) = Colour.Green;
|
---|
| 16 | fishy; // valueE( fishy );
|
---|
| 17 |
|
---|
| 18 | printf( "Compile Time: blue value: %s, position: %d, label: %s, default return value: %s \n", valueE(Colour.Blue), posE(Colour.Blue), labelE(Colour.Blue), Colour.Blue );
|
---|
| 19 | printf( "Runtime: fishy value: %s, position: %d, label: %s, default return value: %s\n", valueE(fishy), posE(fishy), labelE(fishy), fishy );
|
---|
| 20 | Colour c2 = fishy;
|
---|
| 21 | printf( "Runtime: C2 value: %s, position: %d, label: %s, default return value: %s\n", valueE(c2), posE(c2), labelE(c2), c2 );
|
---|
| 22 | Colour.Red;
|
---|
| 23 | char * ao = Colour.Red;
|
---|
| 24 | char * ko = fishy;
|
---|
| 25 | printf( "ao is %s\n", ao );
|
---|
| 26 | printf( "ko is %s\n", ko );
|
---|
| 27 |
|
---|
| 28 | printf( "%d, %d, %d, \n", A, B, C );
|
---|
| 29 | Plain a = B;
|
---|
| 30 | printf( "%d \n", a );
|
---|
| 31 | }
|
---|