C & C++C/C++ 기초 - 구조체 ( Struct ), 비트 필드 ( Bit field )구조체 #include struct My_struct { int a; int i; short b; char c; }; struct My_struct_2nd { int a : 5; int i : 3; short b : 7; char c : 4; }; int main(void) { struct My_struct s1; struct My_struct_2nd s2; s1.a = 10; s1.b = 23; s2.c = 'a'; printf("My_struct size : %d\n", sizeof(My_struct));// 결과 12 printf("My_struct_2nd size : %d", sizeof(My_struct_2nd));// 결과 8 return 0; } '구조체'는 여러 변수를 묶어서 하나의 자료형..더보기
결과물[C/C++ 콘솔] 슬롯 머신학원 주말 과제로 슬롯머신 만들기가 있어서 제작했다. 제작 시간은 12시간 정도 되는 거 같다. 로직 자체는 어렵지 않았는데 더블 버퍼링 적용시키는 거와 꾸미는 부분에서 시간이 좀 들었다. ▽ main.cpp 더보기 #pragma once #include #include "function.h" #include "printers.h" #include "controller.h" #include "result.h" int main() { intslot[3][10] = {}; intremain = 0; intmoney = 10000; intbetting = 10; intpre_time = get_time(); intkey = 0; intdelay = 0; COMMAND_STATEcmd_state = COMMAN..더보기