// file name : ele10.cpp
#include\"stdafx.h\"
#include\"ele.h\"
#ifndef CONIO
#define CONIO
#include<conio.h>
#endif
#ifndef STDIO
#define STDIO
#include<stdio.h>
#endif
Container1::Container1(int max, int floor = 1):
Container(max, floor)
{
dContainer();
}
void Container1::dContainer()
{
int x,y;
x = 32;
y = -2 * GetFloor() + 19;
if( GetContainerState() == MovingUp )
y--;
if( GetContainerState() == MovingDown )
y++;
goto xy(x, y - 2);
printf(\" \");
goto xy(x, y - 1);
printf(\" \");
goto xy(x, y + 3);
printf(\" \");
goto xy(x, y + 4);
printf(\" \");
switch ( GetDoorState() )
{
case Opened:
goto xy(x, y);
printf(\"%c%c%c\",214,205,184);
goto xy(x, y+1);
printf(\"%c%c%c\",186,\' \',186);
goto xy(x, y+2);
printf(\"%c%c%c\",211,205,189);
break;
case Opening:
case Closing:
goto xy(x, y);
printf(\"%c%c%c\",218,210,191);
goto xy(x, y+1);
printf(\"%c%c%c\",179,186,179);
goto xy(x, y+2);
printf(\"%c%c%c\",192,208,217);
break;
case Closed:
goto xy(x, y);
printf(\"%c%c%c\",218,196,191);
goto xy(x, y+1);
printf(\"%c%c%c\",179,\' \',179);
goto xy(x, y+2);
printf(\"%c%c%c\",192,196,217);
break;
}
}
void Container1::dDoor()
{
dContainer();
}
void Container1::dButton()
{
int i;
for( i = 1; i <= 7; i++ )
{
goto xy(12, i+6);
if( GetButton(i) != 0 )
printf(\"%c\", 2);
else
printf(\" \");
}
goto xy(16, 10);
printf(\"in Elevator\");
goto xy(18, 11);
printf(\"%d person(s)\", GetNumber());
}
Container2::Container2(int max, int floor = 7):
Container(max, floor)
{
dContainer();
}
void Container2::dContainer()
{
int x,y;
x = 45;
y = -2 * GetFloor() + 19;
if( GetContainerState() == MovingUp )
y--;
if( GetContainerState() == MovingDown )
y++;
goto xy(x, y - 2);
printf(\" \");
goto xy(x, y - 1);
printf(\" \");
goto xy(x, y + 3);
printf(\" \");
goto xy(x, y + 4);
printf(\" \");
switch ( GetDoorState() )
{
case Opened:
goto xy(x, y);
printf(\"%c%c%c\",214,205,184);
goto xy(x, y+1);
printf(\"%c%c%c\",186,\' \',186);
goto xy(x, y+2);
printf(\"%c%c%c\",211,205,189);
break;
case Opening:
case Closing:
goto xy(x, y);
printf(\"%c%c%c\",218,210,191);
goto xy(x, y+1);
printf(\"%c%c%c\",179,186,179);
goto xy(x, y+2);
printf(\"%c%c%c\",192,208,217);
break;
case Closed:
goto xy(x, y);
printf(\"%c%c%c\",218,196,191);
goto xy(x, y+1);
printf(\"%c%c%c\",179,\' \',179);
goto xy(x, y+2);
printf(\"%c%c%c\",192,196,217);
break;
}
}
void Container2::dDoor()
{
dContainer();
}
void Container2::dButton()
{
int i;
for( i = 1; i <= 7; i++ )
{
goto xy(69, i+6);
if( GetButton(i) != 0 )
printf(\"%c\", 2);
else
printf(\" \");
}
goto xy( 51, 10);
printf(\"in Elevator\");
goto xy( 53, 11);
printf(\"%d person(s)\", GetNumber());
}
///////////////////////////////
엘레베이터를 작성중인데,
elevator\\ele10.cpp(37) : error C3861: \'gotoxy\': identifier not found
elevator\\ele10.cpp(39) : error C2143: syntax error : missing \';\' before \'(\'
elevator\\ele10.cpp(41) : error C2143: syntax error : missing \';\' before \'(\'
elevator\\ele10.cpp(43) : error C2143: syntax error : missing \';\' before \'(\'
elevator\\ele10.cpp(49) : error C2143: syntax error : missing \';\' before \'(\'
elevator\\ele10.cpp(51) : error C2143: syntax error : missing \';\' before \'(\'
elevator\\ele10.cpp(53) : error C2143: syntax error : missing \';\' before \'(\'
elevator\\ele10.cpp(58) : error C2143: syntax error : missing \';\' before \'(\'
elevator\\ele10.cpp(60) : error C2143: syntax error : missing \';\' before \'(\'
이 에러가 납니다. 밑으로 더 있는데, 계속 goto문에서 납니다.
뭐가 문제일까요?
goto xy -> gotoxy
책을 베낄거면 끝까지 베끼고 에러를 확인하기 바랍니다.
맨처음에 잘배껴서...gotoxy라고 했었는데...이렇게 error C3861: \'gotoxy\': identifier not found 에러가 떠서 이걸못잡아서 제가 그래버렸네요;;;이건뭘까요..초보라서 아직 잘모릅니다.
직역해봐요. \'identifier\' 가 뭔진 모르겠지만 이걸 못찾겠대요(not found) . 아무래도 gotoxy 가 뭔지 모르는거겠죠? 검색해보면 얘는 원하는 위치에 커서를 옮겨주는 함수라고 나올거에요. gotoxy(x좌표, y좌표) 그럼 다시 제대로 써봅니다.
댓글감사합니다. 그런데 뭐가 틀렸는지를 모르겠습니다. 검색해서 보니까 gotoxy(37,12); 이런식으로 넣으면 되는거같긴한데, 제가한것과 뭐가 틀린지 모르겠습니다...ㅠㅠ
님은 지금 goto xy 라고 썼잖아요. gotoxy 라니까요. 그리고 헤더파일이 include 되있는지 확인해보고요
아 위에서 gotoxy로 다시 고쳤다고 말씀드렸는데, 전달이 잘안된거같습니다. 고친후에 error C3861: \'gotoxy\': identifier not found 이렇게 난단 말이였습니다. 필요한 헤더파일 다 include 한거같은데도 그렇습니다...ㅠㅠ
헤더파일과 소스파일 다 드리고 왜그런지 묻고싶을정도입니다...ㅠㅠ 제가한건아니지만...이걸 분석하고 돌려보고 제맘대로 고쳐보고싶은데...에러잡는데 하루종일이라...
ㅎㅎ..이런거 잡다보면 나중엔 버그잡는 신이되요. 디버깅하는 것도 소중한 경험이라능
저도 과에 애새끼들 과제도와주느라 디버깅 신됨
ㄴㄴ님 댓글 감사합니다. 근데 우선 급해서...총에러가 41갠데 이것만 한 35개정도되는거같아서....으으 부탁드립니다. 뭐가 잘못되었는지...
gotoxy함수 만들어서 추가 시키세요.
무슨툴 사용혀? 경우에 따라 conio.h에 gotoxy함수가 없을수도 있어... 도스시절에 사용하던거라...
elevator\\ele10.cpp(37) 파일 보면 ele10.cpp 파일의 37번째 줄에 에러가 있단 소린데 그 줄부터 올려줘
댓글들 감사합니다. gotoxy함수 만들어서 추가시키는 걸모르겠습니다...ㅠㅠconio.h가 없길래 해주었는데도 안되고...visual studio 2005쓰고있습니다.
ele10.cpp다시 새글에 올려보겠습니다.