성적입력 프로그램 2일차

Console Programming/C# Console 2019. 9. 24. 17:37
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
 
namespace Syntax10
{
 
    class Program
    {
 
        static void Main(string[] args)
 
        {
            string[] stuListTemp = new string[6];
            string[,] stuList2D = new string[54];
            int index = 0;
            for (; ; )
            {
                Console.WriteLine("1. 조회");
                Console.WriteLine("2. 추가");
                Console.WriteLine("3. 수정");
                Console.WriteLine("4. 삭제");
                Console.WriteLine("5. 종료");
                string selectMenu = Console.ReadLine();
                if (selectMenu == "1")
                {
                    Console.WriteLine($"Total Student: {index+1}");
                    Console.WriteLine();
                    Console.WriteLine("+----+----------------+------+------+------+------+");
                    Console.WriteLine("|번호|     학생명     | 국어 | 수학 | 영어 | 평균 |");
                    Console.WriteLine("+----+----------------+------+------+------+------+");
                    for (int i=0; i<index+1; i++  )
                    {
                        Console.WriteLine($"|{stuList2D[0, i]}|{stuList2D[1, i],6}|{stuList2D[2,i]}|");
                    }
 
                }
                else if (selectMenu == "2")
                {
                    for (; ; )
                    {
                        stuListTemp[0= "000" + (index + 1);
                        Console.Write("학생명: ");
                        stuListTemp[1= Console.ReadLine();
                        Console.Write("국어: ");
                        stuListTemp[2= Console.ReadLine();
                        Console.Write("저장하시겠습니까? (예:1 / 아니오:0) :)");
                        int addStatus = Int32.Parse(Console.ReadLine());
                                                
                        if (addStatus == 1)
                        {
                            stuList2D[0, index] = stuListTemp[0];
                            stuList2D[1, index] = stuListTemp[1];
                            stuList2D[2, index] = stuListTemp[2];
                            break;
                        }
                        else
                            continue;
 
                    }
                }
                else if (selectMenu == "3")
                {
                    //조회가 나오고                    
                    Console.Write($"수정할 데이터 번호를 입력하세요(1~{index + 1}) [0 : Exit]:");
                    int modifyNum = Int32.Parse(Console.ReadLine());
                    Console.Write($"[기존 학생명: {stuList2D[1, modifyNum]} >>");
                    stuList2D[1, modifyNum] =Console.ReadLine();
                    Console.Write($"[기존 국어점수: {stuList2D[2, modifyNum]} >>");
                    stuList2D[2, modifyNum] =Console.ReadLine();
                    break;
 
                }
                else if (selectMenu == "4")
                {
                    //조회가 나오고
                    Console.Write($"삭제할 데이터 번호를 입력하세요(1~{index +1}) [0 : Exit]:");
                    int deleteNum = Int32.Parse(Console.ReadLine());
                    
                    //stuList
 
                }
                //else
                //{
                //    break;
                //}  
            }
        }
    }
}
http://colorscripter.com/info#e" target="_blank" style="color:#e5e5e5text-decoration:none">Colored by Color Scripter
 

 

 

: