0

これらの番号を次のようにリストしようとしています。

1. 114
2. 115
3. 116 

など..私が今持っているコードは次のとおりです。

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

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            int num = 0;
            int count = 114;
            while (count < 146)
            {
                Console.WriteLine(num + "." + count);
                Console.Read();
                count++;

            }
        }
    }
}

私が得る出力は0 = 114で、その後は何もありません..助けてください

4

2 に答える 2

2

forループの使用:

static void Main(string[] args)
{
    int num = 1;

    for (int count = 114; count < 146; count++)
    {
         Console.WriteLine("{0}: {1}", num, count);
         num++;
    }

    Console.Read();
}

ループ内にある場合Console.Read()、プログラムを続行するには Enter キーを押す必要があります。

于 2013-05-15T03:31:05.937 に答える