Perl’de Hesap Makinesi Yapımı
Aşagıdaki kodlarla perl de hesap makinesi yapabilirsiniz..
Aşagıdaki kodlarla perl de hesap makinesi yapabilirsiniz..
Kod:
[COLOR=#000000][FONT=courier new]#Hesap makinesi...[/FONT][/COLOR]
[COLOR=#000000][FONT=courier new] print "Islem sembolunu girin(+,-,*,/)\n";[/FONT][/COLOR]
[COLOR=#000000][FONT=courier new] $sembol=<STDIN>;[/FONT][/COLOR]
[COLOR=#000000][FONT=courier new] print "Ilk sayiyi girin:\n";[/FONT][/COLOR]
[COLOR=#000000][FONT=courier new] $sayi=<STDIN>;[/FONT][/COLOR]
[COLOR=#000000][FONT=courier new] print "Ikinci sayiyi girin:\n";[/FONT][/COLOR]
[COLOR=#000000][FONT=courier new] $sayi2=<STDIN>;[/FONT][/COLOR]
[COLOR=#000000][FONT=courier new] chop($sayi);[/FONT][/COLOR]
[COLOR=#000000][FONT=courier new] chop($sayi2);[/FONT][/COLOR]
[COLOR=#000000][FONT=courier new] chop($islem);[/FONT][/COLOR]
[COLOR=#000000][FONT=courier new] if($sembol eq "+"){[/FONT][/COLOR]
[COLOR=#000000][FONT=courier new] $sonuc = $sayi + $sayi2;[/FONT][/COLOR]
[COLOR=#000000][FONT=courier new] print "Sonuc=$sonuc\n";[/FONT][/COLOR]
[COLOR=#000000][FONT=courier new] }[/FONT][/COLOR]
[COLOR=#000000][FONT=courier new] if($sembol eq "-"){[/FONT][/COLOR]
[COLOR=#000000][FONT=courier new] $sonuc=$sayi - $sayi2;[/FONT][/COLOR]
[COLOR=#000000][FONT=courier new] print "Sonuc=$sonuc\n";[/FONT][/COLOR]
[COLOR=#000000][FONT=courier new] [/FONT][/COLOR]
[COLOR=#000000][FONT=courier new]}[/FONT][/COLOR]
[COLOR=#000000][FONT=courier new] if($sembol eq "*"){[/FONT][/COLOR]
[COLOR=#000000][FONT=courier new] $sonuc=$sayi * $sayi2;[/FONT][/COLOR]
[COLOR=#000000][FONT=courier new] print "Sonuc=$sonuc\n";[/FONT][/COLOR]
[COLOR=#000000][FONT=courier new] }[/FONT][/COLOR]
[COLOR=#000000][FONT=courier new] if($sembol eq "/"){[/FONT][/COLOR]
[COLOR=#000000][FONT=courier new] $sonuc=$sayi / $sayi2;[/FONT][/COLOR]
[COLOR=#000000][FONT=courier new] print "Sonuc=$sonuc\n";[/FONT][/COLOR]
[COLOR=#000000][FONT=courier new] }[/FONT][/COLOR]
[COLOR=#000000][FONT=courier new] print "coded bY ++ByPolice++";[/FONT][/COLOR]
[COLOR=#000000][FONT=courier new] exit();[/FONT][/COLOR]