C# CONSOLE UYGULAMALARI
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { dortislem sonuc = new dortislem(); sonuc.a = 5; sonuc.b = 4; Console.WriteLine("toplam="+sonuc.topla()); Console.WriteLine("fark"+sonuc.fark()); Console.WriteLine("carpim="+sonuc.carpim()); Console.WriteLine("bolüm="+sonuc.bolum()); Console.ReadKey(); } } } |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ConsoleApplication1 { class dortislem { public int a; public int b; public int topla() { return a + b; } public int fark() { return a - b; } public int carpim() { return a * b; } public int bolum() { return a / b; } } } |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ConsoleApplication2 { class Program { static void Main(string[] args) { dikdortgen a = new dikdortgen(); a.kenar1 = 5; a.kenar2 = 12; Console.WriteLine("alan"+a.Alan()); Console.WriteLine("cevre"+a.cevre()); a.ciz(); Console.ReadKey(); } } } |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ConsoleApplication2 { class dikdortgen { public int kenar1; public int kenar2; public int Alan() { return kenar1 * kenar2; } public int cevre() { return 2 * kenar1 * kenar2; } public void ciz() { int k=0; for (int i = 0; i < kenar1; i++) { for (k = 0; k < kenar2; k++) { Console.Write("*"); } Console.WriteLine(); k = 0; } } } } |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ConsoleApplication3 { class Program { static void Main(string[] args) { evhalki a = new evhalki(); a.ad = "ayse"; a.dogumyili = 1993; a.meslek="ögrenci"; a.gozrengi = "yesil"; Console.WriteLine("yas="+a.yas()); a.ozellikleriyaz(); Console.ReadKey(); } } } |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ConsoleApplication3 { class evhalki { public int dogumyili; public string meslek; public string ad; public string gozrengi; public int yas() { return 2013-dogumyili; } public void ozellikleriyaz() { Console.WriteLine("ad;"+ad); Console.WriteLine("gozrengi"+gozrengi); Console.WriteLine("meslek"+meslek); } } } |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ConsoleApplication2 { class dikdortgen { private int en; private int boy; public dikdortgen( int en1, int boy1) { en = en1; boy = boy1; } public int hesap() { return en * boy; } public int get_a { get { if (en < 1) return 1; else return en; } set { en = value; } } public int get_a1 { get { if (boy < 1) return 1; else return boy; } set { boy = value; } } } class Program { static void Main(string[] args) { dikdortgen dik_ = new dikdortgen(8,5); Console.WriteLine(dik_.get_a+"\n"+dik_.get_a1); dik_.get_a = 10; dik_.get_a1 = 89; Console.WriteLine(dik_.get_a+"\n"+dik_.get_a1); Console.WriteLine(dik_.hesap()); Console.ReadLine(); } } } |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ConsoleApplication2 { class dikdortgen { private int en; private int boy; public dikdortgen( int en1, int boy1) { en = en1; boy = boy1; } public int hesap() { return en * boy; } public int get_a() { if (en < 1) return 1; else return en; } public void set_a(int en2) { en = en2; } public void set_b(int boy2) { boy = boy2; } public int get_a1() { if (boy < 1) return 1; else return boy; } } class Program { static void Main(string[] args) { dikdortgen dik_ = new dikdortgen(8,5); Console.WriteLine(dik_.get_a()+"\n"+dik_.get_a1()); Console.WriteLine(dik_.hesap()); dik_.set_a(10); dik_.set_b(20); Console.WriteLine(dik_.hesap()); Console.ReadLine(); } } } |
Leave a reply