使用vb.net打印三角形形状"*" [英] print triangle shape '*' using vb.net

查看:362
本文介绍了使用vb.net打印三角形形状"*"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试以三角形形状打印"*",例如

 *
    * *
   * * *
  * * * *
 * * * * *
* * * * * *



像这样的模式很紧急

我该如何实现呢?

解决方案

我们不做作业:它是有原因的.在这里,您可以考虑自己被告知的内容,并尝试理解它.也可以在那里帮助您的导师识别您的弱点,并将更多的注意力放在补救措施上.

自己尝试,您可能会发现它并不像您想的那么困难!
一个循环就可以做到:

为0至number_of_rows_you_want-1
{
  所需的空间量与当前行号有直接关系.
  *的写入量是迭代次数(当前行).
  在这里,您将需要另一个循环来打印*和空格.
} 



似乎您正在开始,必须了解2个重要的事情:

1.在这里我们不喜欢做家庭作业,但是我们想帮助别人,所以请尝试一下并提出一个具体的问题,我们将为您提供肯定的帮助.
2.以及更重要的是:通常,问题可以分为几部分,总是解决,您将在大多数问题中取得成功.

祝你好运! />

I am trying to print ''*'' in triangle shape like

     *
    * *
   * * *
  * * * *
 * * * * *
* * * * * *



like this pattern very urgent

How can I achieve this?

解决方案

We do not do your homework: it is set for a reason. It is there so that you think about what you have been told, and try to understand it. It is also there so that your tutor can identify areas where you are weak, and focus more attention on remedial action.

Try it yourself, you may find it is not as difficult as you think!


You will have to play with a certain amount of spaces at the beginning of each line.

One loop should do it:

for 0 to number_of_rows_you_want - 1
{
  the amount of spaces needed have a direct relationship with the current row number.
  the amount of * to be written is the number of iteration (current row).  
  here you will need another loop to print the * and spaces.
}



Seems you are starting, 2 important things you must know:

1. here we don''t like to make homework, but we like to help people so try it and come with a specific question and we''ll help for sure.
2. and more important: typically the problems can be divided in small parts, do it ALWAYS and you''ll succeed in most of them.

Good luck!


TryThis


这篇关于使用vb.net打印三角形形状"*"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆