永中首页 | 产品聚焦 | 销售渠道 | 服务支持 | 教育专栏 | 二次开发 | 在线订购 | 产品注册 | 免费下载 | 新闻中心 | 关于永中
发新话题
打印

还有一道简单题

还有一道简单题

输出:
  * * * * * * * *
* * * * * * * *
  * * * * * * * *
* * * * * * * *
  * * * * * * * *
* * * * * * * *
  * * * * * * * *
* * * * * * * *
珍惜现在是幸福!

TOP

还有一道简单题

有人进来指点一下啊,给我门这些初雪者一点建议,永中的人来指点一下啊
为人民服务!!!!!!!!!!!!!!!!!!!!

TOP

还有一道简单题

我是这么做的:
  public static void main(String[] args)
{
   int i,j;
   for(i=1;i<=8;i++)
   {
     if(i%2==1)//奇数行
     {
       for(j=1;j<=8;j++)
        {
          System.out.print(" ");
          System.out.print("*");
         }
         
      }
       if(i%2==0)//偶数行
        {
          for(j=1;j<=8;j++)
            {
               System.out.print("*");
               System.out.print(" ");
             }            
         }
           System.out.println("");
     }
}

我也是初学者,我们是不是同学啊,呵呵。我也想了好长时间才完成的,不过总算是自己做的,虽然时间长点,希望以后一起探讨。myQQ:14741668
令外我想设置一个变量来控制输出的结果,希望高手指点谢谢。
=====初学者=====

TOP

还有一道简单题

这是我的,好像思想差不多哦!
        for(int i=0;i<8;i++)
        {
            switch(i%2)
            {
                case 0:
                for(int j=0;j<8;j++)
                {
                    System.out.print(" *");
                }
                System.out.println("");
                break;
                case 1:
                    for(int j=0;j<8;j++)
                {
                    System.out.print("* ");
                }
                System.out.println("");
                break;
            }
        }
珍惜现在是幸福!

TOP

还有一道简单题

public static void main(String[] args)
    {
        for(int a=1;a<=4;a++)
        {
            for(int i=1;i<=8;i++)
            {
                System.out.print(" *");
            }
            System.out.println("");
            for(int j=1;j<=8;j++) {
                System.out.print("* ");
            }
            System.out.println("");
        }
        
    }
这是我写的,呵呵~,我也是初学者,自己第一次编程序,花了很长时间,一开始没开窍,现在总算有点开窍了,望以后各位高手门多多指教。
我是初学者。

TOP

还有一道简单题

呵呵,我用的方法好象要简单一点哦!
public static void main (String[] args)
    {      
         for(int i=1;i<=8;i++)
         {
            for (int j=1;j<=16;j++)
            {
                if((i+j)%2== 0)
                {
                    System.out.print("*");
                }
                else
                {
                    System.out.print(" ");
                }
            }
            System.out.println(" ");
         }
    }

TOP

还有一道简单题

/**
* FileName: PrintChar.java
* By 终极天王
*/
public PrintChar
{
private int n = 0;
public PrintChar()
{
}
public PrintChar(int n)
{
this.n = n;
}
public void setNum(int n)
{
this.n = n;
}
public void printChar()
{
if (n<=0)
{
return;
}
for(int i = 0; i < n; i++)
{
if (i%2 != 0)
{
System.out.print(" ");
}
for(int j = 0; j < n; j++)
{
System.out.print("*);
}
System.out.print("\n");
}
}
public static void main(String args[])
{
PrintChar pc = new PrintChar();
pc.printChar();
}
}
永中科技开发工程师之一。

TOP

还有一道简单题

[这个贴子最后由庐山神农架在 2002/12/30 07:19pm 编辑]

!!  :em19:
爱一个人需要理由吗?

TOP

还有一道简单题

终极天王用的是公司的开发方式吗?
还有,你的程序好像错了,它要打印的是“* * * * * *”不是“******”
梨,总是大的好!

TOP

发新话题