본문 바로가기
알고리즘/백준 BOJ

[BOJ C#] 4458 첫 글자를 대문자로

by 왹져박사 2023. 1. 12.
728x90
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace _4458
{
    class App
    {
        //생성자
        public App()
        {
            //[BOJ] 4458 첫 글자를 대문자로
            string[] arr = {
                "powdered Toast Man",
                "skeletor",
                "Electra Woman and Dyna Girl",
                "she-Ra Princess of Power",
                "darth Vader"
            };

            //여기서부터 작성 하세요 
            Arr(arr);

            //출력 
            //Powdered Toast Man
            //Skeletor
            //Electra Woman and Dyna Girl
            //She - Ra Princess of Power
            //Darth Vader
        }

        private void Arr(string[] arr)
        {
            for(int i = 0; i < arr.Length; i++)
            {
                StringUpper(arr[i]);
            }
        }
        private void StringUpper(string arr)
        {
            char[] arrChar = new char[arr.Length];
            
            string uppper =  arr[0].ToString().ToUpper();
            arrChar[0] =uppper[0];
            for(int i = 1; i < arr.Length; i++)
            {
                arrChar[i] = arr[i];
            }
            PrintString(arrChar);
        }
        private void PrintString(char[] arrChar)
        {
            Console.WriteLine(arrChar);
        }
    }
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace _4458
{
    class Program
    {
        static void Main(string[] args)
        {
            new App();
        }
    }
}

728x90

'알고리즘 > 백준 BOJ' 카테고리의 다른 글

[BOJ C#] 1181 단어 정렬  (0) 2023.01.12
[BOJ C#] 2711 오타맨 고창영  (0) 2023.01.12
[BOJ C#] 10173 니모를 찾아서  (0) 2023.01.12
[BOJ C#] 9086 문자열  (0) 2023.01.12
[BOJ C#] 괄호 9012 _case1  (0) 2023.01.11