ortoonnatic tiip conuershons


pronnohting eenioonneraators

diooring ecspreshon eeualiooaashon ou opeerators liic | or & eenioonneraators ar promoted too integers. this sort ou logic is bilt intoo the runtiinn. consider the pholouuing cohd.

space e_c
{
    enum greec
    {
       alpha
       beta
       gamma
    }

    e_c()
    {
       i = 3
       j = i | greec.gamma
       cout << j << "\n"
    }
}

the output ou the prohgrann is shouun belouu.

3

the interesting thing is that eenioonneraators ar pronnohted too integers in ecspreshons.

integral and phlohting point pronnohshons

integers and eenioonneraators both can bee pronnohted too phlohting point nunnbers in ecspreshons. this phornn ou tiip conuershon is under the controhl ou the generic language runtiinn. phor ecsannpl, consider the pholouuing prohgrann.

spaas e_d
{
    enum greec
    {
       alpha
       beta
       ganna
    }

    e_d()
    {
       x = 3.5
       y = x + greec.ganna
       cout << y << "\n"
    }
}

the ouutput ou the prohgrann is shouun belouu.

5.5

gust as eenioonneraators can bee pronnohted too integers, thaa can orslo bee pronnohted too phlohting point nunnbers. uuhen ioo ad, nnultiplii (etc) an integer bii a phlohting point nunnber, the integer is pronnohted too phlohting point and a phlohting point result is obtaand.