was tut denn passieren, wenn z.b. eingabe x = -10 u. y = -7?
der kasten soll bald deiner sein
der kasten soll bald deiner sein
function sub($x,$y) {
if(0x80000000&$y)
{
$z=0;
while($z==0){
if($y==0)$z=$z+1;
else{
$x=$x+1;
$y=$y+1;
}
}
return $x;
}
else{
$x=$x-1;
$y=$y-1;
return sub($x,$y);
}
}
function sub($x,$y)
{
$flag1=0;
$flag2=0;
$flag3=0;
$count1=0;
$count2=0;
while($flag1==0){
$count1=$count1+1;
while($flag2==0){
if($count1==0){
if($y==0)return $x;
else{
while($flag3==0){
if($count2==0)$flag3=$flag3+1;
else{
$count2=$count2-1;
$count1=$count1+1;
$y=$y-1;
$x=$x-1;
}
}
$flag3=0;
$flag2=$flag2+1;
}
}
else{
$count1=$count1-1;
$count2=$count2+1;
$x=$x+1;
$y=$y+1;
}
}
$flag2=0;
while($flag2==0){
if($count1==0){
if($y==0)return $x;
else{
while($flag3==0){
if($count2==0)$flag3=$flag3+1;
else{
$count2=$count2-1;
$count1=$count1+1;
$y=$y+1;
$x=$x+1;
}
}
$flag3=0;
$flag2=$flag2+1;
}
}
else{
$count1=$count1-1;
$count2=$count2+1;
$x=$x-1;
$y=$y-1;
}
}
$flag2=0;
}
}
Kommentar