当前位置: 首页 > news >正文

有没有人通过网站建设卖东西的如何制作一个自己的网站

有没有人通过网站建设卖东西的,如何制作一个自己的网站,阿里巴巴网站装修怎么做全屏大图,office文件包里的做网站软件现在发现,打印各种图形还真是要动脑筋的: 1. 发现图形的规律 2. 确定循环语句的控制变量的初始值、增量和循环条件 调试成功的一瞬间,感觉还是挺有成就感的。 另外发现,在本例中,使用嵌套for循环只需4行代码&#x…

现在发现,打印各种图形还真是要动脑筋的:

1. 发现图形的规律

2. 确定循环语句的控制变量的初始值、增量和循环条件

调试成功的一瞬间,感觉还是挺有成就感的。

 

另外发现,在本例中,使用嵌套for循环只需4行代码,而使用while循环实现同样的功能竟然用了11行代码。

看来,Java语言的while, do...while, for都各有所长啊,“一个都不能少”。

 

代码如下:

//JHTP Exercise 5.15: Triangle Printing Program
//by pandenghuang@163.com
/*(Triangle Printing Program) Write an application that displays the following patterns separately,
one below the other. Use for loops to generate the patterns. All asterisks (*) should be printed
by a single statement of the form System.out.print('*'); which causes the asterisks to print side
by side. A statement of the form System.out.println(); can be used to move to the next line. A
statement of the form System.out.print(' '); can be used to display a space for the last two patterns.
There should be no other output statements in the program. [Hint: The last two patterns require
that each line begin with an appropriate number of blank spaces.]*/
import java.util.Scanner;public class Test
{
public static void main(String[] args)
{Scanner input=new Scanner(System.in);System.out.print("请输入三角形的大小(整数):");int size=input.nextInt();int outterCounter=0;int innerCounter=0;//small to large(while statement)System.out.println("使用while循环语句打印左对齐三角形:");while(outterCounter<size){while (innerCounter<=outterCounter){System.out.print("*");innerCounter++;}System.out.println();outterCounter++;innerCounter=0;}//small to large(for statement)System.out.println("\n使用for循环语句打印左对齐三角形:");for (int i=0;i<size;i++){for (int j=0;j<=i;j++)System.out.print("*");System.out.println();}//large to smallSystem.out.println("\n左对齐倒三角形:");for (int i=size;i>=0;i--){for (int j=0;j<=i;j++)System.out.print("*");System.out.println();}//small to large (right aligned)System.out.println("\n右对齐到三角形:");for (int i=0;i<size;i++){for (int j=0;j<size;j++){if (j<i)System.out.print(" ");elseSystem.out.print("*");}System.out.println();}//large to small (right aligned)System.out.println("\n右对齐三角形:");for (int i=0;i<size;i++){for (int j=0;j<size;j++){if (j<size-i-1)System.out.print(" ");elseSystem.out.print("*");}System.out.println();}}
}

 

运行结果:(注意:从Eclipse复制粘贴运行结果时,发生了错位,程序是对的)

请输入三角形的大小(整数):18
使用while循环语句打印左对齐三角形:
*
**
***
****
*****
******
*******
********
*********
**********
***********
************
*************
**************
***************
****************
*****************
******************

使用for循环语句打印左对齐三角形:
*
**
***
****
*****
******
*******
********
*********
**********
***********
************
*************
**************
***************
****************
*****************
******************

左对齐倒三角形:
*******************
******************
*****************
****************
***************
**************
*************
************
***********
**********
*********
********
*******
******
*****
****
***
**
*

右对齐到三角形:
******************
 *****************
  ****************
   ***************
    **************
     *************
      ************
       ***********
        **********
         *********
          ********
           *******
            ******
             *****
              ****
               ***
                **
                 *

右对齐三角形:
                 *
                **
               ***
              ****
             *****
            ******
           *******
          ********
         *********
        **********
       ***********
      ************
     *************
    **************
   ***************
  ****************
 *****************
******************

 



http://www.lbrq.cn/news/2541673.html

相关文章:

  • 合肥网站建设合肥做网站seo网站快速排名软件
  • 滕州网站建设网站行吗推广文章的步骤
  • 做网站的后台开发需要会些什么求职seo
  • php网站标题修改谷歌浏览器下载安装2022最新版
  • 做任务挣钱网站平台营销策略都有哪些
  • 青岛做网站的公司哪个比较好seo效果分析
  • 商城网站建站系统网络推广图片
  • 工程建设信息都在哪个网站发布服装品牌策划及营销推广方案
  • wordpress加入海报功能福州短视频seo机会
  • 徐州网络建站模板站长号
  • 做网站的画布是多少怎么制作网站链接
  • 怎么做网站关键词视频今日头条郑州头条新闻
  • 云南软件开发百度seo快排软件
  • 公司网站首页导航html专业百度seo排名优化
  • 郏县建设局网站seo优化服务是什么
  • 中文网站什么意思软件培训班学费多少
  • dw做网站字体做多大网络营销公司名称
  • 赣州网站网站建设公司关键词排名优化
  • 上海优化公司seo网络推广技术
  • 南康网站网站建设网站友情链接出售
  • 柳市做网站建设百度客服电话号码
  • 百度推广做网站优化落实疫情防控
  • 建设网站怎么输入分子式北京官网seo收费
  • 做英文网站有用吗百度seo优化网站
  • 网站pc客户端制作韩国最新新闻
  • 网站建设河南公司今天刚刚发生的新闻台湾新闻
  • 什么网站可以做字体效果好电工培训学校
  • 淄博网站电子商城平台建设网盘手机app官网下载
  • 欧美做愛网站seo排名软件怎么做
  • 南阳做网站哪家好上海网站排名推广
  • 跨语言AI服务指标收集实战
  • 【Shell脚本自动化编写——报警邮件,检查磁盘,web服务检测】
  • 通过观看数百个外科手术视频课程来学习多模态表征|文献速递-医学影像算法文献分享
  • 理解HTTP协议
  • 电子电气架构 --- 加速48V技术应用的平衡之道
  • android APT技术