0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

改行文字列の読み取り

Posted at

C#で、複数行にわたる改行された文字列を Console.ReadLine で受け取るには、通常の ReadLine では1行しか取得できません。
image.png
例えば上記のように3行に分けて改行がされているものを読み込む場合はループを使います。

2025-03-16_17h01_33.png

7行目のiは、ループの繰り返し回数を管理するためのカウンタ変数です。
通常0から始まるのでi=0としている。3回繰り返すなら、0,1,2の3回なので<3としている。

0
0
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?