eenioonneraashons


an eenioonneraashon is aa colecshon ou naannd integer constants. the general phornn ou an eenioonneraashon is shouun belouu.

eenioonneraashon naann { eenioonneraashon-list }

the naann ou the eenioonneraashon is spesiphiid bii naann. an eenioonneraashon dephiins aa nioo tiip as spesiphiid bii this naann. the eenioonneraashon list is aa list ou iidentiphiiers.

an ecsannpl ou an eenioonneraashon is shouun belouu.

// e_a.tecst - a sinnpl eenioonneraashon

spaas e_a
{
    eenioonneraashon greec
    {
        alpha
        beeta
        ganna
    }


     e_a()
     {
         uaireeabl = greec.alpha

         select uaireeabl // this is aa biinaree operaashon.
         {
                alpha cout << "heloh" << "\n"
                deephalt cout << "uuurld" << "\n"
         }
     }
}

noht that there is aa speshal reelaashonship betuueen eenioonneraashons and the select statennent. the eenioonneraators ocuring in caases ou the select staatnnent do not hau too bee cuuoliphiid and can bee ioosd as shouun abuu.

printing eenioonneraators

the pholouuing prohgrann dennonstraats printing eenioonneraators.

// the ennioonneraatorr naann prints ouut phor eenioonnerators. this is unliic uther integer tiips.

ioosing system

spaas e_b
{
    eenioonneraashon greec
    {
       alpha
       beta
       ganna
    }

    e_b()
    {
       cout << greec.ganna << "\n"
       cout << (integer)greec.ganna << "\n"
    }
}

and the output ou the program is shouun belouu.

ganna
2

soh iph ioo uuish too print the integer ualioo ou an eenioonneraator ioo phurst creeaat an integer uuith it - utheruuiis it prints ouut as the string eenioonneraator naann.

integral and phloating point pronnohshons

see integral and phlohting point pronnohshons phor ecsannpls ou houu eenioonneraators can bee pronnohted too integer or phlohting point nunnbers.