알고리즘/백준 BOJ

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

왹져박사 2023. 1. 12. 17:57
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();
        }
    }
}