次のデータ(終了=Enter のみ) 3 次のデータ(終了=Enter のみ) 5 次のデータ(終了=Enter のみ) 2 次のデータ(終了=Enter のみ) 4 次のデータ(終了=Enter のみ) max= 5 |
前田稔(Maeda Minoru)の超初心者のプログラム入門
![]()
![]()
/******************************/
/*★ Data Input 前田 稔 ★*/
/******************************/
using System;
class Print
{
public static void Main()
{
int val,max;
string str;
max= int.MinValue;
while(true)
{
Console.Write("次のデータ(終了=Enter のみ) ");
str = Console.ReadLine();
if (str==string.Empty) break;
val= Convert.ToInt32(str);
if (max<val) max= val;
}
Console.WriteLine("max= {0}", max);
}
}
|
| max= int.MinValue; |
|
str = Console.ReadLine(); if (str==string.Empty) break; |
![]()
| if (str.Length<1) break; |
![]()