點樣張依個progame改頭換面!大量分(上)

2008-12-05 7:46 am
import java.util.Scanner;
public class asd {
public static void main(String[] args) {

int a[]= {0,0,0,0,0,0,0,0};
int b[]= {0,0,0,0,0,0,0,0};
int c[]= {0,0,0,0,0,0,0,0};
int d[]= {0,0,0,0,0,0,0,0};
int e[]= {0,0,0,0,0,0,0,0};
int f[]= {0,0,0,0,0,0,0,0};
int i,j,k=0,win,y=0;
int play=2,con=0,player1=0,player2=0;

do{
for(i=0;i<7;i++)
{a[i] = 0;
b[i] = 0;
c[i] = 0;
d[i] = 0;
e[i] = 0;
f[i] = 0;}
play =2;
do{

win=0;
for(j=0;j<=20;j++)
System.out.print("\n");

System.out.print("5 | ");
for(j=0;j<=6;j++)
System.out.print(f[j] +" ");

System.out.print("\n4 | ");
for(j=0;j<=6;j++)
System.out.print(e[j] +" ");

System.out.print("\n3 | ");
for(j=0;j<=6;j++)
System.out.print(d[j] +" ");

System.out.print("\n2 | ");
for(j=0;j<=6;j++)
System.out.print(c[j] +" ");

System.out.print("\n1 | ");
for(j=0;j<=6;j++)
System.out.print(b[j] +" ");

System.out.print("\n0 | ");
for(j=0;j<=6;j++)
System.out.print(a[j] +" ");

System.out.print("\n ");
for(j=0;j<=12;j++)
System.out.print("-");
System.out.print("\n 0 1 2 3 4 5 6\n");

for(j=0;j<=3;j++){
if(a[j] ==y && a[j+1] ==y && a[j+2] ==y && a[j+3] ==y)
win++;
else if(b[j] ==y && b[j+1] ==y && b[j+2] ==y && b[j+3] ==y)
win++;
else if(c[j] ==y && c[j+1] ==y && c[j+2] ==y && c[j+3] ==y)
win++;
else if(d[j] ==y && d[j+1] ==y && d[j+2] ==y && d[j+3] ==y)
win++;
else if(e[j] ==y && e[j+1] ==y && e[j+2] ==y && e[j+3] ==y)
win++;
else if(f[j] ==y && f[j+1] ==y && f[j+2] ==y && f[j+3] ==y)
win++;
}


for(j=0;j<=5;j++)
if(a[j] ==y && b[j] ==y && c[j] ==y && d[j] ==y)
win++;
else if(b[j] ==y && c[j] ==y && d[j] ==y && e[j] ==y)
win++;
else if(c[j] ==y && d[j] ==y && e[j] ==y && f[j] ==y)
win++;

回答 (2)

2008-12-08 10:18 pm
✔ 最佳答案
又係D java 101 course D program......你ge意思係唔係想抄功課?
唉......我諗你o係唔明呢隻program的情況下想抄ge話就將D variable改晒名佢,再group埋D code做function啦。
不過隻program都寫得幾爛......你點抄都係好覺架啦......明左佢再寫過啦
參考: 大學電腦系的學生,精補電腦XD
2008-12-05 3:07 pm
用c/c++再寫一次
圖片參考:http://tw.yimg.com/i/tw/ugc/rte/smiley_4.gif



收錄日期: 2021-04-13 16:17:43
原文連結 [永久失效]:
https://hk.answers.yahoo.com/question/index?qid=20081204000051KK02091

檢視 Wayback Machine 備份