メニューに戻りたいときはここをクリック。
x=1 x=x+2 x=x+3 x=x*2 msgbox(x)というプログラムを実行すると何が表示されるか。
msgbox("私は札幌○×高校2年10組11番小泉純一郎です。")
s=0
for i=1 to 99 step 2
s=s+i*i
next
msgbox s
n=inputbox("あなたが入力した数以下の奇数の和を求めます。")
s=0
for i=1 to n step 2
s=s+i
next
msgbox s,,"合計"
n=inputbox("あなたが入力した数以下の3の倍数の和を求めます。")
s=0
for i=3 to n step 3
s=s+i
next
msgbox s,,"合計"
x=inputbox("何円持っている?","所持金調査")
if x>=10000 then
s=x & "円とは、なかなか金持ちですね。"
else
s=x & "円ですか。わかりました。"
end if
msgbox s,,"おこたえ"
dim x(30) x(1)=-9: x(2)=29: x(3)=7: x(4)=28: x(5)=2: x(6)=1: x(7)=2: x(8)=-12: x(9)=13: x(10)=0 x(11)=0: x(12)=-19: x(13)=-3: x(14)=-10: x(15)=5: x(16)=8: x(17)=27: x(18)=15: x(19)=8: x(20)=1 x(21)=-7: x(22)=-12: x(23)=-8: x(24)=17: x(25)=25: x(26)=14: x(27)=16: x(28)=19: x(29)=19: x(30)=-1上記プログラムに続けて、x(1)〜x(30)の中の最大値と最小値を求めて、「最大値は○○、最小値は○○」と表示するプログラムを完成させよ。
dim x(30)
x(1)=-9: x(2)=29: x(3)=7: x(4)=28: x(5)=2: x(6)=1: x(7)=2: x(8)=-12: x(9)=13: x(10)=0
x(11)=0: x(12)=-19: x(13)=-3: x(14)=-10: x(15)=5: x(16)=8: x(17)=27: x(18)=15: x(19)=8: x(20)=1
x(21)=-7: x(22)=-12: x(23)=-8: x(24)=17: x(25)=25: x(26)=14: x(27)=16: x(28)=19: x(29)=19: x(30)=-1
max=x(1)
min=x(1)
for i=2 to 30
if max<x(i) then max=x(i)
if min>x(i) then min=x(i)
next
msgbox "最大値は" & max & "、最小値は" & min
dim x(30)
x(1)=-9: x(2)=29: x(3)=7: x(4)=28: x(5)=2: x(6)=1: x(7)=2: x(8)=-12: x(9)=13: x(10)=0
x(11)=0: x(12)=-19: x(13)=-3: x(14)=-10: x(15)=5: x(16)=8: x(17)=27: x(18)=15: x(19)=8: x(20)=1
x(21)=-7: x(22)=-12: x(23)=-8: x(24)=17: x(25)=25: x(26)=14: x(27)=16: x(28)=19: x(29)=19: x(30)=-1
max=x(1)
for i=2 to 30
if max<x(i) then max=x(i)
next
min=x(1)
for i=2 to 30
if min>x(i) then min=x(i)
next
msgbox "最大値は" & max & "、最小値は" & min
count=1
n=inputbox("1*2*3*4*5*6*7*8*9=?","問題")
if n<>"" then if n=362880 then ok=1
do while (ok=0 and count<5)
count=count+1
n=inputbox("不正解だ! 1*2*3*4*5*6*7*8*9=?","しっかりしろ")
if n<>"" then if n=362880 then ok=1
loop
if ok=1 then
msgbox "正解だ! 入力回数は" & count & "回",, "おめでとう"
else
msgbox "馬鹿! 正解は 362880 だ!",,"真面目にやれ!"
end if
dim x(30) x(1)=-9: x(2)=29: x(3)=7: x(4)=28: x(5)=2: x(6)=1: x(7)=2: x(8)=-12: x(9)=13: x(10)=0 x(11)=0: x(12)=-19: x(13)=-3: x(14)=-10: x(15)=5: x(16)=8: x(17)=27: x(18)=15: x(19)=8: x(20)=1 x(21)=-7: x(22)=-12: x(23)=-8: x(24)=17: x(25)=25: x(26)=14: x(27)=16: x(28)=19: x(29)=19: x(30)=-1上記プログラムに続けて、x(1)〜x(30)をバブルソートによって、大きい順に並べ替えて表示するプログラムを書け。
dim x(30)
x(1)=-9: x(2)=29: x(3)=7: x(4)=28: x(5)=2: x(6)=1: x(7)=2: x(8)=-12: x(9)=13: x(10)=0
x(11)=0: x(12)=-19: x(13)=-3: x(14)=-10: x(15)=5: x(16)=8: x(17)=27: x(18)=15: x(19)=8: x(20)=1
x(21)=-7: x(22)=-12: x(23)=-8: x(24)=17: x(25)=25: x(26)=14: x(27)=16: x(28)=19: x(29)=19: x(30)=-1
last=29
do
gyakuten=0
for i=1 to last
if x(i)<x(i+1) then
temp=x(i):x(i)=x(i+1):x(i+1)=temp
gyakuten=1
end if
next
last=last-1
loop while gyakuten=1
for i=1 to 30
kekka=kekka & x(i) & ", "
next
msgbox kekka,,"ソートの結果"
dim x(30) x(1)=-9: x(2)=29: x(3)=7: x(4)=28: x(5)=2: x(6)=1: x(7)=2: x(8)=-12: x(9)=13: x(10)=0 x(11)=0: x(12)=-19: x(13)=-3: x(14)=-10: x(15)=5: x(16)=8: x(17)=27: x(18)=15: x(19)=8: x(20)=1 x(21)=-7: x(22)=-12: x(23)=-8: x(24)=17: x(25)=25: x(26)=14: x(27)=16: x(28)=19: x(29)=19: x(30)=-1上記プログラムに続けて、x(1)〜x(30)を単純選択法により小さい順に並べ替えて表示するプログラムを書け。
dim x(30)
x(1)=-9: x(2)=29: x(3)=7: x(4)=28: x(5)=2: x(6)=1: x(7)=2: x(8)=-12: x(9)=13: x(10)=0
x(11)=0: x(12)=-19: x(13)=-3: x(14)=-10: x(15)=5: x(16)=8: x(17)=27: x(18)=15: x(19)=8: x(20)=1
x(21)=-7: x(22)=-12: x(23)=-8: x(24)=17: x(25)=25: x(26)=14: x(27)=16: x(28)=19: x(29)=19: x(30)=-1
for last=30 to 2 step -1
max=x(1)
max_n=1
for i=1 to last
if x(i)>max then
max=x(i)
max_n=i
end if
next
temp=x(max_n):x(max_n)=x(last):x(last)=temp
next
for i=1 to 30
kekka=kekka & x(i) & ", "
next
msgbox kekka,,"ソートの結果"
randomize x=rnd*100 if x<10 then s="天使に祝福された1日になるでしょう。": title="大吉" if x>=10 and x<60 then s="まあまあラッキーな日でしょう":title="吉" if x>=60 and x<80 then s="辛抱していればラッキーなこともある1日でしょう":title="末吉" if x>=80 and x<93 then s="災いの種があります。気をつけましょう。":title="凶" if x>=93 then s="悪霊接近中。「物忌み」、「方違え」について調べてしっかり対策を立てましょう。":title="大凶" msgbox s,,title
古代ローマ (ローマ帝国 の歴史とコイン)