forked from danny-R/Test
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcmd.php
More file actions
70 lines (60 loc) · 1.52 KB
/
cmd.php
File metadata and controls
70 lines (60 loc) · 1.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
<?php
echo "入力してください";
$input = fgets(STDIN);
echo "入力したもの:";
echo $input;
$flug = true;
do {
print '\n';
print 'a+bのaを入力(数字)';
$input_a = fgets(STDIN);
print 'a = ';
print $input_a;
print 'これでいいですか? y/n';
do {
$input =fgets(STDIN);
$input = rtrim($input);
if (strcasecmp($input, 'Y') == 0
|| strcasecmp($input, 'y') == 0) {
$input_a = rtrim($input_a);
$flug = false;
break;
} else if (strcasecmp($inpput, 'N') == 0
|| strcasecmp($input, 'n') == 0) {
break;
}
} while (true);
} while ($flug);
$FLUG = true;
do {
print '\n';
print 'a+bのbを入力(数字)';
$input_b = fgets(STDIN);
print 'b = ';
print $input_b;
print 'これでいいですか? y/n';
do {
$input =fgets(STDIN);
$input = rtrim($input);
if (strcasecmp($input, 'Y') == 0
|| strcasecmp($input, 'y') == 0) {
$input_b = rtrim($input_b);
$flug = false;
break;
} else if (strcasecmp($input, 'N') == 0
|| strcasecmp($input, 'n') == 0) {
break;
}
} while (true);
} while ($flug);
$add_ad = intval($input_a) + intval($input_b);
print 'a + b = ';
print $add_ad;
print "\n";
while (true) {
$input = fgets(STDIN);
$input = rtrim($input);
if (strcasecmp($input, '\e') == 0) {
return;
}
}