[C++]커피 자판기
- 최초 등록일
- 2006.06.22
- 최종 저작일
- 2006.05
- 30페이지/ 압축파일
- 가격 2,000원
소개글
C++로 짠 커피자판기입니다.
목차
<b>자판기.dsp
자판기.dsw
자판기.ncb
자판기.opt
자판기.plg
coinContain.cpp
contain.cpp
inputCPUandPannel.cpp
main.cpp
processCPU.cpp
vanding.h
vendingmachine.cpp
vendingmachineBack.cpp</b>
본문내용
#include "vanding.h"
/****************************** inputCPU 클래스 맴버함수 ******************************/
// 생성자
inputCPU::inputCPU()
{
fileInput.open("inputfile.txt");
interrupt=0;
}
// 동전이 입력되고, 버튼이 눌리고, 반환버튼이 눌리는 이벤트들에 대하여 처리 하는 함수
// (입력 문자열을 이벤트들의 연속된 집합으로 가정하여 적법하면 processCPU에게 값 전달)
void inputCPU::Run(processCPU *Primary)
{
while(!interrupt){ // cpu에게 인터럽트를 보내지 않았으면
inputdataRead(); // 문자열 받고,
checkAndinterrupt(Primary); // 문자열 테스트하여 적법하면 인터럽트 보낸다.
}
interrupt=0;
}
// 사용자에게든 파일에게든 문자열을 입력받는다
void inputCPU::inputdataRead()
{
char temp[100];
cout << "명령을 입력하세요 : " ;
cout.flush();
fileInput.getline(temp,99);
if(fileInput.eof() && fileInput.gcount()==0){ // 파일의 끝에 도달하여 읽지 못한경우
cin.getline(temp,99); // 키보드로 부터 입력받는다.
}
else cout << temp << endl;
strcpy(inputStr, temp);
}
// 일련의 이벤트들의 집합이라고 가정한 문자열을 분석하여 적법하면 인터럽트 거는 함수
void inputCPU::checkAndinterrupt(processCPU *Primary)
{
int index=0;
int state1;
instruct state2;
menuType state3;
while(inputStr[index]==`\t` || inputStr[index]==` `)index++; //최초 공백처리
/* 100, 500, fill, manage 중 하나의 입력이 들어왔는지 체크 */
if(!strncmp(&inputStr[index],"100",3)) //100으로 시작하면
state1=100;
참고 자료
없음
압축파일 내 파일목록
contain.cpp
inputCPUandPannel.cpp
main.cpp
processCPU.cpp
vanding.h
vendingmachine.cpp
vendingmachineBack.cpp
자판기.dsp
자판기.dsw
자판기.ncb
자판기.opt
자판기.plg