C# 0 The Complete Reference


PART I C h a p t e r   9



Download 4,07 Mb.
Pdf ko'rish
bet324/1096
Sana23.01.2022
Hajmi4,07 Mb.
#402171
1   ...   320   321   322   323   324   325   326   327   ...   1096
Bog'liq
C-Sharp 3 The Complete Reference Herbert Schildt


PART I

C h a p t e r   9 :  

O p e r a t o r   O v e r l o a d i n g  

243


PART IPART I

    // Add an int to a Nybble.

    a += 5;

    Console.WriteLine("a after a += 5: " + (int) a);

    Console.WriteLine();

    // Use a Nybble in an int expression.

    t = a * 2 + 3;

    Console.WriteLine("Result of a * 2 + 3: " + t);

    Console.WriteLine();

    // Illustrate int assignment and overflow.

    a = 19;

    Console.WriteLine("Result of a = 19: " + (int) a);

    Console.WriteLine();

    // Use a Nybble to control a loop.

    Console.WriteLine("Control a for loop with a Nybble.");

    for(a = 0; a < 10; a++)

      Console.Write((int) a + " ");

    Console.WriteLine();

  }

}

The output from the program is shown here:



a: 1

b: 10


a is less than b

c after c = a + b: 11

a after a += 5: 6

Result of a * 2 + 3: 15

Result of a = 19: 3

Control a for loop with a Nybble.

0 1 2 3 4 5 6 7 8 9

Although most of the operation of 



Nybble

 should be easy to understand, there is one 

important point to make: The conversion operators play a large role in the integration of 

Nybble

 into the C# type system. Because conversions are defined from 




Download 4,07 Mb.

Do'stlaringiz bilan baham:
1   ...   320   321   322   323   324   325   326   327   ...   1096




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish