Topic: 是我符号的问题还是语法的问题~

  Print this page

1.是我符号的问题还是语法的问题~ Copy to clipboard
Posted by: aiff
Posted on: 2004-09-29 15:18

class temp
{
public static void main(String args[])
{
int i,j,k;
for(i=0;i<100;i++)

for(j=0;j<100;j++)
for(k=0;k<100;k++)
if (i+j+k==100&9*i+6*j+k==300)
System.out.println(i);
System.out.println(j);
System.out.println(k);
}
}错了吗?

2.Re:是我符号的问题还是语法的问题~ [Re: aiff] Copy to clipboard
Posted by: sharplei
Posted on: 2004-09-29 15:25

if后面打{}了没有啊?

3.大菜 [Re: aiff] Copy to clipboard
Posted by: battlekiller
Posted on: 2004-09-29 18:19

if 后面没有{}

4.Re:是我符号的问题还是语法的问题~ [Re: aiff] Copy to clipboard
Posted by: why
Posted on: 2004-09-29 19:06

It would be easier for you to find the problem if you have your code indented properly.

public class Temp
{

public static void main(String args[])
{
int i,j,k;
for(i=0;i<100;i++)
for(j=0;j<100;j++)
for(k=0;k<100;k++)
if (i+j+k==100 & 9*i+6*j+k==300)
System.out.println(i);
System.out.println(j);
System.out.println(k);
}

}


while you want

public class Temp
{

public static void main(String args[])
{
int i,j,k;
for(i=0;i<100;i++)
for(j=0;j<100;j++)
for(k=0;k<100;k++)
if (i+j+k==100 & 9*i+6*j+k==300)
{
System.out.println(i);
System.out.println(j);
System.out.println(k);
}
}

}

5.Re:是我符号的问题还是语法的问题~ [Re: aiff] Copy to clipboard
Posted by: april518
Posted on: 2004-10-03 17:40

  WHY大哥讲的有道理.写代码要规范,养成好的习惯.这样以后会省很多的麻烦.

6.Re:是我符号的问题还是语法的问题~ [Re: aiff] Copy to clipboard
Posted by: 寒江独钓
Posted on: 2004-10-05 15:30

嘿嘿
我开始也这样粗心 不过现在好了!!
努力+毅力=胜利!!


   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923