小编Ale*_*fly的帖子

如何画一个正方形

我在绘制以下方块时遇到麻烦:

* # # # # # 
* * # # # # 
* * * # # # 
* * * * # # 
* * * * * # 
* * * * * *
Run Code Online (Sandbox Code Playgroud)

这是我写的方法,但它不能正常工作:

public void Draw(int width){
    char asterisk = '*';
    char hash = '#';
    int counter = 0;
    for (int h = 0; h < 6; h++) { //height?
        for (int w = 0; w < width; w++) {
            if (h == counter)
                Console.Write …
Run Code Online (Sandbox Code Playgroud)

c# console-application

0
推荐指数
1
解决办法
5772
查看次数

标签 统计

c# ×1

console-application ×1