歡迎光臨 pure C# 技術社群. 登入註冊

pure C# 技術社群

- Microsoft .NET Framework 相關技術非官方討論社群 -

C# 主控台應用問題 幫解決

  • 1
  • [第1/1頁 共6項]
#1

C# 主控台應用問題 幫解決

  • a
 0.0 (0 人評價)


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication2
{
    class Program
    {
        static void Main(string[] args)
        {
            int c = int.Parse(Console.ReadLine());
            string YT1 = "@";
            string YT2 = "*";
            int q = 0;
            for (int i = c; i > 0; )
            {

                if (q < c)
                {
                    if (q < 40)
                    {
                        Console.WriteLine(YT1);
                    }
                    else
                        if (q > 40)
                        {
                            Console.WriteLine(YT2);
                        }
                }
                else
                    if (q > c)
                    {
                        i = 0;
                    }
                q = q + 5;
            }
            Console.ReadLine();
        }
    }
}


輸入50  印出來是
@
@
@
@
@
@
@
@
*
我想要變成
@
@@
@@@
@@@@
@@@@@
@@@@@@
@@@@@@@
@@@@@@@@
@@@@@@@@*
要如何改寫
請大大們幫忙解答  謝謝


  • 回覆
  • |
  • 引用
  • |
  • 編輯
  • |
  • 私人訊息


贊助商連結

#2

Re: C# 主控台應用問題 幫解決

  • a
 0.0 (0 人評價)


  • 回覆
  • |
  • 引用
  • |
  • 編輯
  • |
  • 私人訊息

#3

Re: C# 主控台應用問題 幫解決

  • a
 0.0 (0 人評價)
哇靠    小弟對您的景仰有如江水滔滔連綿不絕...

老闆, 請給我提神用的細肩帶小女孩不加辣, 謝謝
  • 回覆
  • |
  • 引用
  • |
  • 編輯
  • |
  • 私人訊息

#4

Re: C# 主控台應用問題 幫解決

  • a
 0.0 (0 人評價)
引用 的文章:
哇靠    小弟對您的景仰有如江水滔滔連綿不絕...


好說好說~解法還有多種~
端看原po敢用哪一種去交作業

  • 回覆
  • |
  • 引用
  • |
  • 編輯
  • |
  • 私人訊息

#5

Re: C# 主控台應用問題 幫解決

  • a
 0.0 (0 人評價)

引用 的文章:


好說好說~解法還有多種~
端看原po敢用哪一種去交作業


我用
int c = int.Parse(Console.ReadLine());
            Console.WriteLine("您目前年齡=    " + c + "歲");
            Console.ReadLine();
            for (int q = 0; q < c; q += 5)
            {
                if (q < 40)
                    Console.WriteLine(new string('@', q / 5 + 1));
                else
                    Console.WriteLine(new string('@', 8) + new string('*', (q - 40) / 5 + 1));
            }
            Console.ReadLine();

因為你給我的
是在輸入50的情況下
但是我只的50 是我假設的
輸入的數字 要由使用者設定
所以我就自己 改成這樣嚕= ="


  • 回覆
  • |
  • 引用
  • |
  • 編輯
  • |
  • 私人訊息

#6

Re: C# 主控台應用問題 幫解決

  • a
 0.0 (0 人評價)
實在是太超過了
實在是太超過了

  • 回覆
  • |
  • 引用
  • |
  • 編輯
  • |
  • 私人訊息
  • 1
  • [第1/1頁 共6項]