输出星号矩形 [英] Output an asterisk rectangle
本文介绍了输出星号矩形的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
此程序打印一个矩形的轮廓,其中包含6个星号
和8个星号。
输入:无
输出:打印矩形的轮廓。
This program prints the outline of a rectangle with 6 asterisks
across and 8 asterisks down.
Input: None
Output: Prints the outline of the rectangle.
展开 | 选择 < span class =codeDivider> | Wrap | 行号
推荐答案
它始终打印''*'',因为NUM_ACROSS == 8总是如此。但是你没有说出它做错了什么。
It always prints ''*'' because NUM_ACROSS==8 is always true. You didn''t say what is it doing wrong, though.
你可能会尝试添加大括号。您的循环没有按照您认为的方式进行编译。它们应该是:
You might try adding braces. Your loops are not being compiled they way you think they are. They should be:
展开 | 选择 | Wrap | 行号
现在我只是越过顶部。
************
你有什么想法我为什么不排在前排吗?
这就是我现在所拥有的。
Now I am just getting the line across the top.
************
Do you have any ideas why I am not getting the down row?
this is what I have now.
展开 | 选择跨度> | Wrap | 行号
这篇关于输出星号矩形的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文