• 검색 결과가 없습니다.

[2011 03 17].Ch4.상수란무엇인가

N/A
N/A
Protected

Academic year: 2021

Share "[2011 03 17].Ch4.상수란무엇인가"

Copied!
11
0
0

로드 중.... (전체 텍스트 보기)

전체 글

(1)

Intelligence Modeling Lab.

School of Information and Communication Engineering, Sungkyunkwan University

컴퓨터공학실습 1

Part 1

Ch4. 상수란 무엇인가

2011-03-17

1

(2)

목차

상수란

(3)

Intelligence Modeling Lab.

School of Information and Communication Engineering, Sungkyunkwan University

상수란

어떤 상황에서도 변하지 않는 값을 의미

프로그램에서 데이터는 변수 / 상수의 형태로 사용 가능

변수와 상수의 비교

변수 : 변수에 저장된 값을 변경 가능

상수 : 상수 값을 변경하는 것이 불가능

3

(4)

리터럴 상수와 심볼릭 상수

상수의 종류

리터럴 상수 (literal constant)

문자 그대로의 상수 ( 별도의 이름 없음 )

정수형 상수

실수형 상수

문자 상수

문자열 상수

심볼릭 상수 (symbolic constant)

상수를 기호화하여 이름을 붙여서 사용

const 키워드 사용

#define 문 사용

(5)

Intelligence Modeling Lab.

School of Information and Communication Engineering, Sungkyunkwan University

리터럴 상수와 심볼릭 상수

리터럴 상수 - 정수형 상수

(6)

리터럴 상수와 심볼릭 상수

10

진수

16

진수

8

진수

0

0x

0

0

0

1

0x

1

0

1

2

0x

2

0

2

3

0x

3

0

3

4

0x

4

0

4

5

0x

5

0

5

6

0x

6

0

6

7

0x

7

0

7

8

0x

8

0

10

9

0x

9

0

11

10

0x

a

0

12

11

0x

b

0

13

12

0x

c

0

14

13

0x

d

0

15

14

0x

e

0

16

15

0x

f

0

17

16

0x

10

0

20

17

0x

11

0

21

(7)

Intelligence Modeling Lab.

School of Information and Communication Engineering, Sungkyunkwan University

리터럴 상수와 심볼릭 상수

리터럴 상수 - 실수형 상수

(8)

리터럴 상수와 심볼릭 상수

리터럴 상수 – 문자 상수

알파벳 , 특수 기호 등 ⇒ 컴퓨터 내에서는 숫자로 저장

(9)

Intelligence Modeling Lab.

School of Information and Communication Engineering, Sungkyunkwan University

리터럴 상수와 심볼릭 상수

리터럴 상수 – 문자열 상수

(10)

리터럴 상수와 심볼릭 상수

심볼릭 상수 (symbolic constant)

상수를 기호화하여 이름을 붙여서 사용하는 상수

심볼릭 상수 선언 방법

① const 키워드 사용

const int

NUM = 100;

const

double

PI = 3.14;

② #define 문 이용하기

(11)

Intelligence Modeling Lab.

School of Information and Communication Engineering, Sungkyunkwan University

리터럴 상수와 심볼릭 상수

심볼릭 상수

참조

관련 문서

School of Mechanical Systems Engineering Chonnam National University..

 캐리어 비교 방식 SVPWM 방법은 전압-시간 평균 이론에 바탕을 둔 SVPWM 방법의 특성을 그대로 가지면서 그 구현이 매우 간편하고 게이트에 실제로 인가되는

Ø 집단 k개 중 어느 것과 어느 것의 평균이 같거나 다른지 알고자 함. Ø 어느 집단 간에 차이가 있는지

USB 연결 케이블을 이용하여 라즈베리 파이와 센서보드 연결 라즈베리 파이의 USB 포트와 WeDo 의 컴퓨터 연결 허브를 연결하 면 된다...

Department of Naval Architecture and Ocean Engineering, Seoul National University of College of Engineering.. Ship Motion & Wave Load

School of Computer Science & Engineering Seoul

School of Mechanical and Aerospace Engineering Seoul National University..

School of Mechanical and Aerospace Engineering Seoul National University..