10 READ $NAME 20 READ $WAIT 30 READ $HEIGHT 40 READ $OLD 60 IF ($HEIGHT>=160)*($HEIGHT<170) THEN PRINT $NAME;$CHR(13) 50 IF (READ<>"END")*($WAIT<>0)*($HEIGHT<>0)*($OLD<>0) THEN 10 70 END 100 REM --BODY INFORMATION-- 110 DATA "SUZUKI",67,150,15 120 DATA "SATOU",80,180,24 130 DATA "ITO",74,170,18 140 DATA "TANAKA",90,190,20 150 DATA "YAMADA",45,168,16 160 DATA "SIMIZU",68,165,18 170 DATA END,0,0,0 180 REM --INFORMATION END--
7 :
$の位置が逆じゃね?
8 :
デバッグしますた。(´・ω・`)ショボーン 10 READ NAME$ 20 READ WAIT 30 READ HEIGHT 40 READ OLD 60 IF (HEIGHT>=160)*(HEIGHT<170) THEN PRINT NAME$;CHR$(13) 50 IF (NAME$<>"END")*(WAIT<>0)*(HEIGHT<>0)*(OLD<>0) THEN 10 70 END 100 REM --BODY INFORMATION-- 110 DATA "SUZUKI",67,150,15 120 DATA "SATOU",80,180,24 130 DATA "ITO",74,170,18 140 DATA "TANAKA",90,190,20 150 DATA "YAMADA",45,168,16 160 DATA "SIMIZU",68,165,18 170 DATA END,0,0,0 180 REM --INFORMATION END--
9 :
MZ-1200 SP-5030なら上で動くはずだけど、下の場合は動かない。 でも、Tiny Basic for Windowsだとエラーがでた。 下でないとエラーが出る。 10 READ NAME$ 20 READ WAIT 30 READ HEIGHT 40 READ OLD 50 IF (HEIGHT>=160) and (HEIGHT<170) THEN PRINT NAME$;CHR$(13) 60 IF (NAME$<>"END") and (WAIT<>0) and (HEIGHT<>0) and (OLD<>0) THEN 10 70 END 80 REM --BODY INFORMATION-- 110 DATA "SUZUKI",67,150,15 120 DATA "SATOU",80,180,24 130 DATA "ITO",74,170,18 140 DATA "TANAKA",90,190,20 150 DATA "YAMADA",45,168,16 160 DATA "SIMIZU",68,165,18 170 DATA "END",0,0,0 180 REM --INFORMATION END--
110 N=5:DIM NA$(N) 120 FOR I = 1 TO N 130 READ NA$(I),W,H,A 140 PRINT "No.";I,"体重";W 150 NEXT 160 INPUT "一番体重の軽い番号を入力して下さい:", X 170 IF X <= 0 OR N < X THEN 160 180 PRINT "一番体重の軽い人は "; NA$(X); " です." 190 END 200 DATA "SUZUKI",67,150,15 210 DATA "SATOU",80,180,24 220 DATA "ITO",74,170,18 230 DATA "TANAKA",90,190,20 240 DATA "YAMADA",45,168,16
>>33 10 DIM A(99,99):INPUT "n";N:IF N MOD 2 = 0 THEN PRINT "( ´,_ゝ`)プッ":END 20 X=N\2+1:Y=1:FOR I=1TO N*N:A(Y,X)=I:X=(X+(I MOD N=0)) MOD N+1:Y=Y+(I MOD N<>0)*2+1-((Y-(I MOD N=0)*2-1)=0)*N:NEXT 30 FOR I=1TO N:FOR J=1TO N:PRINT A(I,J);:NEXT:PRINT:NEXT:END
良スレハケーン Microsoft Visual Studio .NETなんですが よくある3×3マスの○×ゲームのソースをお願いできないでしょうか
50 :
>>49 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Debug.WriteLine("×|○|○") Debug.WriteLine("--+--+--") Debug.WriteLine("○|×| ") Debug.WriteLine("--+--+--") Debug.WriteLine(" | |×") Debug.WriteLine("俺の勝ち") End End Sub
>>54 110 N=5 120 INPUT "氏名:";S$ 130 FOR I=1 TO N 140 READ A$,B$,C$ 150 IF S$="氏名" THEN PRINT "住所と電話番号":END 160 NEXT 170 END 180 DATA "鈴木","北海道","AAAA-BB-CCCC" 190 DATA "佐藤","埼玉県","DDD-EEE-FFFF" 200 DATA "伊藤","奈良県","GGG-HHH-IIII" 210 DATA "田中","福岡県","JJJJ-KK-LLLL" 220 DATA "山田","沖縄県","MMMM-NN-OOOO"
四則演算の電卓を作るプログラムなんですけど、ここからわかりません。 ご指摘お願いします。 Dim a As Integer Dim b As Integer Dim c As Integer Dim d As Integer Dim e As Integer Dim f As Integer Dim g As Integer Dim h As Integer Dim i As Integer Dim j As Integer Dim tasu As Integer Dim hiku As Integer Dim kakeru As Integer Dim waru As Integer
74 :
-------------------------- Private Sub Command1_Click() Text1.Text = "0 End Sub -------------------------- Private Sub Command10_Click() Text1.Text = "9" End Sub -------------------------- Private Sub Command11_Click() a = Val(Text1.Text) b = Val(Text1.Text) c = Val(Text1.Text) d = Val(Text1.Text) e = Val(Text1.Text) f = Val(Text1.Text) g = Val(Text1.Text h = Val(Text1.Text i = Val(Text1.Text) j = Val(Text1.Text) Text1.Text = "" End Sub
75 :
-------------------------- Private Sub Command12_Click() tasu = Val(Text1.Text) hiku = Val(Text1.Text) kakeru = Val(Text1.Text) waru = Val(Text1.Text)
一応Cで書くとこんな感じになると思うのですが これをVisualBasicに書き直すのがうまくいきません。 #include <stdio.h> int lcm(int x,int y,int z); main() { int a,b,c,d; printf("整数aを入力 "); scanf("%d",&a); printf("整数bを入力 "); scanf("%d",&b); printf("整数cを入力 "); scanf("%d",&c); d = lcm(a,b,c); printf("%d と %d と %d の最小公倍数は %d です。\n",a,b ,c,d); } int lcm(int x,int y,int z) { int answer; answer = x; while(1){ if(answer % y == 0 && answer % z == 0) break; answer += x; } return answer; }
81 :
>>80 残りのUI関係は自分でやっとくれ。 Function lcm(ByVal x As Integer, ByVal y As Integer, ByVal z As Integer) As Integer Dim answer As Integer answer = x Do If ((answer Mod y = 0) And (answer Mod z = 0)) Then Exit Do answer = answer + x Loop lcm = answer End Function
82 :
おまけ: ユークリッドの互除法を使った場合 Function gcd(ByVal a As Integer, ByVal b As Integer) As Integer Dim c As Integer Do While b <> 0 c = a Mod b a = b b = c Loop gcd = a End Function Function lcm(ByVal a As Integer, ByVal b As Integer) As Integer lcm = a * b / gcd(a, b) End Function Function lcm3(ByVal a As Integer, ByVal b As Integer, ByVal c As Integer) As Integer Dim d As Integer d = lcm(a, b) lcm3 = lcm(c, d) End Function
>>86 (仮称)十進BASIC INPUT s$ LET m=LEN(s$) FOR n=1 TO INT(m/2) FOR i=1 TO m-n+1 IF s$(i:i+n-1) = s$(i+n:i+2*n-1) THEN PRINT s$(i:i+n-1) END IF NEXT i NEXT n END