C# 강의 - 변수 형식 바꾸기 안녕하세요. 이솔찬입니다.이번에는 C#에서 변수 형식을 바꿔보겠습니다. C#은 변수 형식을 바꿀 수 있습니다.바꿀 수 있는 목록입니다. int -> floatint -> stringfloat -> intfloat -> stringstring -> intstring -> float 1. 먼저 int 변수에서 float로 바꿔보겠습니다. 12int a = 1;float b = (float)a;cs 2. int, float 변수에서 string으로 바꿔보겠습니다. 12int a = 1; // float 형식도 가능string b = a.ToString();cs 3. float에서 int로 바꿔보겠습니다. 12float a = 1.5f;int b = (int)a;cs 4. string에서 int로 바꿔보겠습니다.. C# 강의/콘솔 다루기 6년 전
C# 강의 - 2. int, float, bool, string 변수 안녕하세요. 이솔찬입니다.이번에는 C#에서 int, float, bool, string 변수를 사용해 보겠습니다. 변수 형식은 다음과 같습니다. int: 숫자 변수float: 소수점이 포함된 변수bool: 참과 거짓으로 사용되는 변수string: 문자열 변수 먼저 Visual Studio에서 C# 콘솔 앱을 생성합니다.프로젝트 이름은 Data로 설정합니다. 프로젝트가 생성되면 기본으로 있는 코드입니다. 123456789101112131415using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks; namespace Data{ class Program { static.. C# 강의/콘솔 다루기 6년 전