This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
object run { | |
def main(args: Array[String]): Unit = { | |
var myList : List[Int] = List.range(1,10) // 1 to 9 liste yaratılır. | |
println("myList : " + myList) | |
println("Sum : " + sumList(myList) ) | |
println("Odd Sum : " + sumList(myList, i => if (i%2 != 0) i else 0 )) | |
println("Odd Sum2 : " + sumList(myList, oddSumBlock )) | |
println("Even Sum : " + sumList(myList, i => if (i%2 == 0) i else 0 )) | |
println("Even Sum2 : " + sumList(myList, evenSumBlock )) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace Tolpp.Delegates2.Context | |
{ | |
/// <summary> | |
/// Kullanicilar uzerinde yapilan islemleri handle eden temel delegate | |
/// </summary> | |
/// <param name="user">Uzerinde islem yapilan kullanici</param> | |
public delegate void UserEventHandler(User user); | |
/// <summary> | |
/// Kullanicilar uzerinde islemlerin yapildigi siniftir |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
procedure bubbleSort( A : sıralanacak eleman dizisi ) | |
n = length(A) | |
do | |
newn = 0 | |
swapped = false | |
for (i = 0; i < n-1; i++) do: | |
if A[i] <; A[i+1] then | |
swap(A[i], A[i+1]) | |
newn = i + 1 | |
swapped = true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Sıralı arama algoritmasına ait pseudocode] | |
for i ← 0 to n-2 do | |
min ← i | |
for j ← (i + 1) to n-1 do | |
if A[j] < A[min] | |
min ← j | |
swap A[i] and A[min] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Hayvan{ | |
public Hayvan(){} | |
public void sesCikar(){System.out.println("AbidikGubidik");} | |
} | |
public class Kopek extends Hayvan{ | |
public Kopek(){} | |
@Override | |
public void sesCikar(){System.out.println("BarkHavBarkHav");} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Hayvan minnos = new Hayvan(); | |
Hayvan fino = new Kopek(); | |
minnos.sesCikar(); | |
fino.sesCikar(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static void Main(string[] args) | |
{ | |
int a; //değişkene bir ilk değer atamak zorunda değilim, çünkü out parametreli bir fonksiyona gönderdim | |
//Console.WriteLine(a); --> bu satır derleyici tarafından hatalı kabul edilir. Çünkü değişkene değer atayan f fonksiyonu çağırılmamıştır | |
f(out a); | |
Console.WriteLine(a); | |
Console.ReadLine(); | |
} | |
private static void f(out int sayi) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MyC | |
{ | |
private string _isim; | |
public string Isim | |
{ | |
get { return _isim; } // getIsim() fonksiyonundan kurtaran get propertysi | |
set { _isim = value; } // setIsim(string isim) fonksiyonundan kurtaran set propertysi | |
} | |
public MyC(string s){this._isim=s;} //MyC sınıfımın yapıcı (constructor) metodu | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public delegate void myDel(int c,string d); // myDel isimli delegemi class seviyesinde tanımlıyorum | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
myDel yazdir = new myDel(adFiyatYaz); //Delegemin instance'ını adFiyatYaz fonksiyonunu kullanarak oluşturuyorum | |
yazdir += new myDel(kdvYaz); // yazdir delegate'ime yeni bir myDel intance'ı ekliyorum | |
/* Yukarıda adFiyatYaz ve kdvYaz metodlarımı yazdır isimli myDel tipindeki delegemin içine attım. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sieve(n) | |
//Eratosthenes'in Eleği'nin implementasyonu | |
//Input: n > 1 olan n tamsayısı | |
//Output: n'den küçük veya n e eşit asal sayılar dizisi | |
for p←2 to n do A[p]←p | |
for p←2 to floor(sqrt(n)) do | |
if A[p] != 0 //daha önceki döngü içerisinde p elenmemişse | |
j ← p ∗ p | |
while j ≤ n do | |
A[j]←0 //j. elemanı elenmiş olarak işaretle |
OlderNewer