enum spectrum{red, orange, yellow, green, blue , violet, indigo, ultrviolet{

spectrum band;

band=blue; // 맞음

 

band =2000; // 틀림

 

band=orange;

++band; //틀림 될수도 있지만 일반적으로 위험하며 이식성을 높이기위해 사용해선안된다.

 

band=orange+red;//틀림

 

int color =blue; //맞다

band=3;//틀리다 

color=3+red //맞다

 

band=spectrum(3); // 맞다

band=spectrum(40003);//미확정 

 

'프로그래밍언어 > C++' 카테고리의 다른 글

strcpy, strcnpy 차이  (0) 2020.09.08
문자열 복사와 대입  (0) 2020.09.08
union, struct 차이  (0) 2020.09.02
문자열 string c++  (0) 2020.08.31
부동 소수점수  (0) 2020.08.28

+ Recent posts