초기 커밋.

This commit is contained in:
2025-03-05 10:21:10 +09:00
parent 3471914e64
commit 15885a2286
55 changed files with 1716 additions and 0 deletions
+73
View File
@@ -0,0 +1,73 @@
// See https://aka.ms/new-console-template for more information
// for 루프
using System.Diagnostics;
for (int x = 0; x < 10; x++)
{
Console.WriteLine("Loop {0}", x);
}
string[] array = new string[] { "AB", "CD", "EF" };
// foreach 루프
foreach (string s in array)
{
Console.WriteLine(s);
}
// 3차배열 선언
string[,,] arr = new string[,,] {
{ {"1", "2"}, {"11","22"} },
{ {"3", "4"}, {"33", "44"} }
};
//for 루프 : 3번 루프를 만들어 돌림
for (int i = 0; i < arr.GetLength(0); i++)
{
for (int j = 0; j < arr.GetLength(1); j++)
{
for (int k = 0; k < arr.GetLength(2); k++)
{
Debug.WriteLine(arr[i, j, k]);
}
}
}
//foreach 루프 : 한번에 3차배열 모두 처리
foreach (var s in arr)
{
Debug.WriteLine(s);
}
int y = 1;
// while 루프
while (y <= 10)
{
Console.WriteLine(y);
y++;
}
y = 0;
// do ~ while 루프
do
{
Console.WriteLine(y);
y++;
} while (y < 10);
//Enumerable
List<char> keyList = new List<char>();
ConsoleKeyInfo key;
do
{
key = Console.ReadKey();
keyList.Add(key.KeyChar);
} while (key.Key != ConsoleKey.Q); // Q가 아니면 계속
Console.WriteLine();
foreach (char ch in keyList) // 리스트 루프
{
Console.Write(ch);
}