11 Temmuz 2011 Pazartesi

C# ++ Ve - - Operatörlerinin Kullanımı

 using System;
 using System.Collections.Generic;
 using System.Text;

 namespace forOrnek
 {
 class Program
 {
 static void Main(string[] args)
 {
 // ++ ve -- unary operatörlerinin kullanımı

 int x, y;

 y = 5;
 x = y++ * 2;
 Console.WriteLine("x = y++ * 2 işleminden sonra y = {0} ve x = {1}", y, x);

 y = 5;
 x = ++y * 2;
 Console.WriteLine("x = ++y * 2 işleminden sonra y = {0} ve x = {1}", y, x);

 y = 5;
 x = y-- * 2;
 Console.WriteLine("x = y-- * 2 işleminden sonra y = {0} ve x = {1}", y, x);

 y = 5;
 x = --y * 2;
 Console.WriteLine("x = --y * 2 işleminden sonra y = {0} ve x = {1}", y, x);

 }
 }
 }

0 yorum:

Yorum Gönder