最新回答 / 慕运维1046652
多了一行输出<?phpdefine('PI','3.14');define('PII','3.14');echo(PI);echo'<br />';echo(PII);
2019-03-28
<?php
$sum = 12;//小宠物当前的饥饿程度
echo "我饿啦:-(";
echo "<br />";
$max =0; //初始次数
while($sum<100){
$num = rand(1,20);//随机数,模拟喂食小宠物的小面包
$sum = $sum + $num; //小宠物吃小面包
$max = $max+1;
echo "我还没吃饱呢!";
echo "本次饥饿程度恢复到:".$sum."";
echo "<br />";
}
echo "终于吃饱啦^_^";
echo "一共喂了".$max."次!";
?>
$sum = 12;//小宠物当前的饥饿程度
echo "我饿啦:-(";
echo "<br />";
$max =0; //初始次数
while($sum<100){
$num = rand(1,20);//随机数,模拟喂食小宠物的小面包
$sum = $sum + $num; //小宠物吃小面包
$max = $max+1;
echo "我还没吃饱呢!";
echo "本次饥饿程度恢复到:".$sum."";
echo "<br />";
}
echo "终于吃饱啦^_^";
echo "一共喂了".$max."次!";
?>
2019-03-14