no message
This commit is contained in:
25
Question03-if/Ex08.php
Normal file
25
Question03-if/Ex08.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
$money_in_hand = 1000; // 所持金
|
||||
|
||||
// 前の画面で選択された値を、変数select_itemに代入してください
|
||||
$select_item = ($_POST['item']);
|
||||
|
||||
//---------------------ここから本題-----------------------
|
||||
/*
|
||||
* 以下の仕様に沿ってプログラムを完成させてください
|
||||
*
|
||||
* ●選択された商品を購入
|
||||
* ●所持金から、対応した商品の値段分を引く
|
||||
* ●最後に所持金を表示してプログラム終了
|
||||
*
|
||||
* ※ プログラムは何行書いても良いです
|
||||
*/
|
||||
if ($select_item == 1) {
|
||||
$money_in_hand = $money_in_hand - 150;
|
||||
} else if ($select_item == 2) {
|
||||
$money_in_hand = $money_in_hand - 160;
|
||||
} else if ($select_item == 3) {
|
||||
$money_in_hand = $money_in_hand - 200;
|
||||
}
|
||||
echo '所持金' . $money_in_hand;
|
||||
Reference in New Issue
Block a user