C#프로그래밍 64

문자열 보간

using System; using System.ComponentModel; namespace HelloWorld { internal class Program { static void Main(string[] args) { //이름 변수 초기화 "홍길동" string characterName = "홍길동"; //나이 변수 정의 int age; //나이 변수에 값(12) 할당 age = 12; //이름 : 홍길동 //나이 : 12 //문자열 보간 Console.WriteLine("이름: " + characterName); Console.WriteLine("나이: " + age); Console.WriteLine("이름: {0}\n나이: {1}", characterName, age); Console.Writ..

C#프로그래밍 2023.07.19

결합연산자

using System; using System.ComponentModel; namespace HelloWorld { internal class Program { static void Main(string[] args) { //주석 //변수를 정의 //변수에 값 할당 //변수의 초기화 //값 타입 : 문자열, 숫자 (정수, 실수) //문자열 : string //정수 : int //실수 : //경험치 : 23.54% float exp = 23.54f; // 변수 정의, 값을 할당 (초기화) //하나의 문자열을 만들어 낸다. string str = "경험치: " + exp + "%"; Console.WriteLine(str); // + : 산술연산자, 문자열+x (결합연산자) , 결합해서 하나의 문자열로 만..

C#프로그래밍 2023.07.19

HelloWorld

using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace HelloWorld { internal class Program { static void Main(string[] args) // 생각 코딩 검증 예상 실행 { //변하는 거 , 변하지 않는 거 , 정보 저장 -> 변수 / 대상은 -> 값 //변수를 선언하고 값을 할당 (변수의 초기화) string characterName = "홍길동"; Console.WriteLine("이름: " + characterName); int level; // 변수 선언, 정의 level = 12; //..

C#프로그래밍 2023.07.19