Codice:
#!usr/bin/perl
#Fire-Crash
&function;
sub function
{
print q
{
######################################
# Calculator Created By Fire-Crash #
######################################
Choose a operations:
1)Addition
2)Subtraction
3)Multiplication
4)Division
5)Raising power
};
$choose = <STDIN>;
if($choose == 1)
{
system("cls");
print "Insert the first number ";
$addone = <stdin>;
print "Insert the second number ";
$addtwo = <stdin>;
$addresult = $addone + $addtwo;
print "Result = $addresult";
<stdin>;
system(cls);
}
elsif($choose == 2)
{
system("cls");
print "Insert the first number ";
$subone = <stdin>;
print "Insert the second number ";
$subtwo = <stdin>;
$subresult = $subone - $subtwo;
print "Result = $subresult";
<stdin>;
system(cls);
}
elsif($choose == 3)
{
system("cls");
print "Insert the first number ";
$multone = <stdin>;
print "Insert the second number ";
$multwo = <stdin>;
$multresult = $multone * $multwo;
print "Result = $multresult";
<stdin>;
system(cls);
}
elsif($choose == 4)
{
system("cls");
print "Insert the first number ";
$divone = <stdin>;
print "Insert the second number ";
$divtwo = <stdin>;
$divresult = $divone / $divtwo;
print "Result = $divresult";
<stdin>;
system(cls);
}
elsif($choose == 5)
{
system(cls);
print "Insert the number ";
$raisone = <stdin>;
print "Insert the exponent ";
$raistwo = <stdin>;
$raisresult = $raisone ** $raistwo;
print "Result = $raisresult";
<stdin>;
system(cls);
}
&function;
};
very very good XD