프로그래밍/C#
C# 문자->숫자
코딩줌마
2019. 3. 24. 08:56
static void Main(string[] args)
{
StreamReader file = new StreamReader("numbers.txt");
List<int> list = new List<int>();
while (!file.EndOfStream)
{
string s = file.ReadLine();
list.Add(Int32.Parse(s));
}
Console.WriteLine("===== 정렬 전 =====");
for(int i=0;i<list.Count;i++) {
Console.Write(list[i]+ ": ");
}
Console.WriteLine("\n\n===== 정렬 후 =====");
list.Sort();
for (int i = 0; i < list.Count; i++)
{
Console.Write(list[i] + ": ");
}
Console.WriteLine("\n");
}
반응형