1. sayfa
using System; class Sinif { public int Sayi; public int this[int indeks] { get { return Sayi; } set { if(indeks>0) Sayi+=value; else if(indeks<0) Sayi-=value; else Sayi=Sayi; } } } class AnaProgram { static void Main() { Sinif a=new Sinif(); a[5]=45; a[-10]=23; a[100]=87; a[-80]=100; Console.WriteLine(a[0]); } }
45-23=22
22+87=109
109-100=9
Bu mesaja 1 cevap geldi. Cevapları Gizle