초기 커밋.

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
+10
View File
@@ -0,0 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
</Project>
+41
View File
@@ -0,0 +1,41 @@
internal class Program
{
private static void Main(string[] args)
{
// 1차 배열
string[] players = new string[10];
string[] Regions = { "서울", "경기", "부산" };
// 2차 배열 선언 및 초기화
string[,] Depts = { { "김과장", "경리부" }, { "이과장", "총무부" } };
// 3차 배열 선언
string[,,] Cubes;
//Jagged Array (가변 배열)
//1차 배열 크기(3)는 명시해야
int[][] A = new int[3][];
//각 1차 배열 요소당 서로 다른 크기의 배열 할당 가능
A[0] = new int[2];
A[1] = new int[3] { 1, 2, 3 };
A[2] = new int[4] { 1, 2, 3, 4 };
A[0][0] = 1;
A[0][1] = 2;
int[] scores = { 80, 78, 60, 90, 100 };
int sum = CalculateSum(scores); // 배열 전달: 배열명 사용
Console.WriteLine(sum);
}
static int CalculateSum(int[] scoresArray) // 배열 받는 쪽
{
int sum = 0;
for (int i = 0; i < scoresArray.Length; i++)
{
sum += scoresArray[i];
}
return sum;
}
}