vending machine (자판기) simulator
- 최초 등록일
- 2005.09.04
- 최종 저작일
- 2005.09
- 21페이지/ 한컴오피스
- 가격 1,000원
컴파일 실행환경
vc++ 6.0 콘솔 환경에서 컴파일.
윈도즈 환경에서 실행 가능.
본문내용
#include <iostream.h>
#include <iomanip.h>
#include <string.h>
#include "CPanel.h"
#include "CEngine.h"
#include "CContainer.h"
#define CODE_MAX 20 //code[]의 max size에 대한 define.
class CVendingMachine{
CPanel *VM_panel;
CEngine *VM_engine;
CContainer *cup, *water, *coffee, *sugar, *cream; //재료통 (컵, 물, 커피, 설탕, 크림)
CContainer *WON_500, *WON_100; //동전통 (500원, 100원)
void state_output(); //자판기의 각종 객체 상태를 출력해 주는 method.
public:
CVendingMachine();
~CVendingMachine();
void on(); //자판기의 전원이 켜진 상태에서의 동작을 관리하는 method.
};
#endif
Code of "CVendingMachine.cpp"
#include "CVendingMachine.h"
CVendingMachine::CVendingMachine(){
VM_panel = new CPanel();
VM_engine = new CEngine();
cup = new CContainer("컵", 5, 5, 1); // (이름, 최대치, 남은양, 떨어지는 양)
water = new CContainer("물", 5, 5, 1);
coffee = new CContainer("커피", 5, 5, 1);
sugar = new CContainer("설탕", 5, 5, 1);
cream = new CContainer("크림", 5, 5, 1);
WON_500 = new CContainer("500원", 10, 5, 1); // (이름
참고 자료
없음