如何在vb.net中制作反向金字塔 [英] how to make a reverse pyramid in vb.net

查看:143
本文介绍了如何在vb.net中制作反向金字塔的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

现在已经过了一个星期..

有人可以指导我如何在vb.net中制作一个反向金字塔吗?对我来说任务很糟糕......工作一个星期,因为我是新的.. :(请建议??

它应该是这样的。左右两侧的空间减少( - )意味着空间。使用循环我知道它可以通过它完成..但没有用..紧急:(请提供给我的vb.net..thanks并高度赞赏



Its been a week now..
Can somebody please guide me how to make a reverse pyramid in vb.net??Hell of task to me..Working for a week as i am new in it .. :( Please advice??
it should be like this.Having spaces at both right and left to decrements (-) means spaces..Tried using loops and i know it can be done through it.. but to no use..its urgent :( please provide me for the vb.net..thanks and highly appreciated

**********
-********-
--*****--
--****--
---**---
----*--





代码添加评论





Code added from comment

a = 1
For a = 5 To 1 Step -1
   b = 1
   For b = 1 To 6 - a
      Response.Write(" ")
   Next b
   c = 1
   For c = 1 To a
      Response.Write(" * ")
   Next c
   Response.Write("</br>")
Next a



我用过这个..但它没有给我右侧空间......



[/ Edit]


I have used this..but its not giving me space on the right side...

[/Edit]

推荐答案

我们不做你的作业:这是有原因的。它就是为了让你思考你被告知的事情,并试着理解它。它也在那里,以便您的导师可以识别您身体虚弱的区域,并将更多的注意力集中在补救措施上。



亲自尝试,你可能会发现它不是和你想的一样困难!



如果遇到具体问题,请询问相关问题,我们会尽力提供帮助。但我们不打算为你做这一切!



但我会给你一个提示:你需要两个循环,一个在另一个内部。 />
首先让外循环打印出你需要的行数(空白换行符),

并打印每行所需的星星数量。

如果你有这个工作,用第二个循环替换星数打印来打印正确数量的星星。



这是基本的东西:将任务分解为更小,更容易做的工作然后再做。
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!

If you meet a specific problem, then please ask about that and we will do our best to help. But we aren't going to do it all for you!

But I'll give you a hint: You need two loops, one inside the other.
Start by getting the outer loop to print the number of lines you need (blank newlines),
and print the number of "stars" you want on each line as well.
When you have that working, replace the "stars count" print with a second loop to print the right number of stars.

This is basic stuff: breaking down the task into smaller, easier-to-do jobs and then doing them.


这篇关于如何在vb.net中制作反向金字塔的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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