Notes
Notes - notes.io |
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication12
{
class Program
{
static void Main(string[] args)
{
int sayi1, sayi2,islem;
Console.WriteLine("1.sayiyi girin:");
sayi1 = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("2.sayiyi girin:");
sayi2 = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("1-Toplama:");
Console.WriteLine("2-Cikarma:");
Console.WriteLine("3-Carpma:");
Console.WriteLine("4-Bolme");
Console.WriteLine("Bir islem seciniz");
islem = Convert.ToInt32(Console.ReadLine());
switch (islem)
{
case 1:{Console.WriteLine(topla(sayi1,sayi2));
break;}
case 2:{Console.WriteLine(cikar(sayi1,sayi2));
break;}
case 3:{Console.WriteLine(carp(sayi1,sayi2));
break;
}
case 4:{Console.WriteLine(bol(sayi1,sayi2));
break;}
default:
{
Console.WriteLine("yanlis islem");
break;
}
}
Console.ReadKey();
}
static int topla(int sayi1, int sayi2)
{
return sayi1 + sayi2;
}
static int cikar(int sayi1, int sayi2)
{
return sayi1 - sayi2;
}
static int carp(int sayi1, int sayi2)
{
return sayi1 * sayi2;
}
static int bol(int sayi1, int sayi2)
{
return sayi1 / sayi2;
}
}
}
-------------------------------------------------
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication1
{
class Tarih
{
private int g, a, y;
public Tarih()//yapıcı metod sınıf ile aynı ada sahip
{
g = 30;
a = 1;
y = 1985;
}
public int gunoku
{
get { return g; }
set { g = value; }
}
public int ayoku
{
get { return a; }
set { a = value; }
}
public int yiloku
{
get { return y; }
set { y = value; }
}
public void tarih_goster()
{
Console.WriteLine(g + "." + a + "." + y);
}
}
class Program
{
static void Main(string[] args)
{
Tarih dogum_gunu = new Tarih();
Console.WriteLine("Deger atamasi yapilmadan once yapıcı metot degerleri gozukur");
dogum_gunu.tarih_goster();
dogum_gunu.gunoku = 18;
dogum_gunu.ayoku = 12;
dogum_gunu.yiloku = 2012;
Console.WriteLine("Deger atamasi yapildiktan sonra");
dogum_gunu.tarih_goster();
Console.ReadKey();
}
}
}
----------------------------------------------
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication1
{
class dikdortgen
{
public int kisa_kenar;
public int uzun_kenar;
public int alan_hesapla()
{
return kisa_kenar * uzun_kenar;
}
public int cevre_hesapla()
{
return (kisa_kenar + uzun_kenar) * 2;
}
}
class Kare
{
public int kenar_uzunlugu; //private : dışarıdan bu değişkene erişilmesi engelleniyor.
public int alan_hesapla() //value anahtar sözcüğü sizin ona ilettiğiniz verinin türündendir ve her türlü değeri alabilir.
{
return kenar_uzunlugu * kenar_uzunlugu;
}
public int cevre_hesapla()
{
return 4 * kenar_uzunlugu;
}
}
class Program
{
static void Main(string[] args)
{
dikdortgen dk1 = new dikdortgen();
dk1.kisa_kenar = 5;
dk1.uzun_kenar = 10;
Console.WriteLine("dikdortgen alan ="+dk1.alan_hesapla());
Console.WriteLine("dikdortgen cevre ="+dk1.cevre_hesapla());
Kare bizim_kare = new Kare();
bizim_kare.kenar_uzunlugu = Convert.ToInt16(Console.ReadLine());
Console.WriteLine("kare alan ="+bizim_kare.alan_hesapla());
Console.WriteLine("Kare cevre ="+bizim_kare.cevre_hesapla());
Console.ReadKey();
}
}
}
--------------------------------------
------------------------------------
------------------------------------
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Exercices
{
class araba
{
public string karakter;
public int model = 3000;
public int indexini_bul(string metin, string metin2)
{
int index = 0;
for (int i = 0; i < metin2.Length; i++)
{
if (parca_al(metin2, i, metin.Length) == metin)
{
index = i;
break;
}
}
return index;
}
public string degistir(string metin, string metin2, string metin3)
{
string birlestir = "";
int index = 0;
for (int i = 0; i < metin3.Length; i++)
{
if (parca_al(metin3, i, metin.Length) == metin)
{
birlestir = parca_al(metin3, 0, i);
birlestir = birlestir + metin2;
birlestir = birlestir + parca_al(metin3, (i + metin2.Length), metin3.Length - birlestir.Length);
index = i;
break;
}
}
return birlestir;
}
public string birlestir(char karakter, string[] dizi, string metin)
{
string ekle = "";
for (int i = 0; i < dizi.Length; i++)
{
if (i < dizi.Length)
ekle = ekle + (dizi[i] + karakter);
}
return ekle;
}
public string parca_al(string metin, int a, int b)
{
string ekle = "";
for (int i = 0; i < metin.Length; i++)
{
if (i >= a)
{
for (int j = 0; j < b; j++)
{
ekle = ekle + metin[i + j];
}
break;
}
}
return ekle;
}
}
}
---------------------------------------
-----------
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace denemeler
{
public class YAZI
{
public static string Parca_al(string kelime, int baslangic, int bitis)
{
string istenilen = "";
for (int i = 0; i < kelime.Length; i++)
{
if (i >= baslangic)
{
for (int k = 0; k < bitis; k++)
{
istenilen = istenilen + kelime[i + k];
}
break;
}
}
Console.WriteLine("İstediğiniz harf:" + istenilen);
return istenilen;
}
/**********************************************************************/
public static void index_bul(string indeksibulanacakkelime, string kelime)
{
int indx = 0;
for (int i = 0; i < kelime.Length; i++)
{
if (indeksibulanacakkelime == kelime)
{
indx = i;
break;
}
}
Console.WriteLine(indx);
}
}
class Program
{
static void Main(string[] args)
{
string girilenmetin;
int baslangıc, bitis;
Console.Write("Bir kelime giriniz:");
girilenmetin = Console.ReadLine();
Console.Write("Kaçıncı harften itibaren almak istiyorsunuz:");
baslangıc = Convert.ToInt32(Console.ReadLine());
Console.Write("Kaçıncı harfe kadar almak istiyorsunuz:");
bitis = Convert.ToInt32(Console.ReadLine());
string parca = YAZI.Parca_al(girilenmetin, baslangıc, bitis);
YAZI.index_bul(parca, girilenmetin);
Console.ReadLine();
}
}
}
|
Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...
With notes.io;
- * You can take a note from anywhere and any device with internet connection.
- * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
- * You can quickly share your contents without website, blog and e-mail.
- * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
- * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.
Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.
Easy: Notes.io doesn’t require installation. Just write and share note!
Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )
Free: Notes.io works for 12 years and has been free since the day it was started.
You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;
Email: [email protected]
Twitter: http://twitter.com/notesio
Instagram: http://instagram.com/notes.io
Facebook: http://facebook.com/notesio
Regards;
Notes.io Team