Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
Tags
- pm2 상태 확인
- setInterval clear
- listener 1883
- allow_anonymouse
- transfer
- setInterval 정지
- pm2 시작
- AntDesign
- c# datagridview 데이터 넣기
- datagridview 직접입력
- map이 undefined가 뜰 때
- setInterval 중지
- pm2 설치
- invalid data
- html #select #option #multiple
- timepicker
- 공인IP
- DataGridView 직접 입력
- mosquitto
- DatePicker
- mosquitto.conf
- mySQL_Replication
- 데이터테이블 데이터 넣기
- setInterval 외부 정지
- pm2 확인
- 서버동기화
- Replication
- pm2
- 1883
- 맥 어드레스
Archives
- Today
- Total
개발 노트
변수,상수 본문
변수
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApp3
{
internal class Program
{
static void Main(string[] args)
{
int i = 12345;
char c = 'A';
float f = 3.14f;
double d = 42.195;
string s = "문자열";
int maxInt = int.MaxValue;
Console.WriteLine("{0:c}, {1:d}, {2:c}, {3:e}", i, i, i, i);
Console.WriteLine("{0}", c);
Console.WriteLine("{0:f}, {1:0.0}, {2:0.000}", f, f, f);
Console.WriteLine("{0:f}, {1:g}, {2:n}", d, d, d);
Console.WriteLine("{0:g}, {1:g}, {2:g}", c, s, maxInt);
}
}
}
컨트롤 f5를 누르면 결과 값이 나온다
포멧형식은 통화(Currency){0:c} 이런형식으로 12345를 넣었을때 \12,345 로 나옴
{2:c} 의 의미는 3번째 있는 변수 i(12345)를 Currency(화폐) 형식
상수
using System;
namespace ConsoleApp1
{
class Program
{
static void Main(string[] args)
{
const double PI = 3.14;
double R = 3;
double circumference = 2 * PI * R;
double area = R * R * PI;
Console.WriteLine("원의 둘레 = {0}", circumference);
Console.WriteLine("원의 넓이 = {0}", area);
}
}
}
상수는 값을 변경하면 오류가 난다
'프로그래밍 > C#' 카테고리의 다른 글
간단한 사칙연산 프로그램 (0) | 2022.01.11 |
---|---|
c# 조건문,switchcase (0) | 2022.01.11 |
비주얼스튜디오 c#프로젝트를 선택할때 (0) | 2022.01.11 |
c#스터디 패널,객체 (0) | 2022.01.11 |
ftp-파일질라서버참고사이트 (0) | 2022.01.10 |