|
http://www.hackerschool.org/HS_Boards/zboard.php?AllArticle=true&no=6315 [복사]
int x,y;
char cal_operator;
char inexit[5];
////// 계산기변수 선언 윗부분.//////
printf("\n Welcome to the calculator. \n");
while(1)
{
printf("If you want to exit this function input 'exit'. \n");
printf("Continue: press any key and enter. \n");
fflush(stdin);
scanf("%s", &inexit);
/////이부분
if(inexit=="exit\0")
break;
printf("Input x value: ");
scanf("%d", &x);
printf("Input y value: ");
scanf("%d", &y);
fflush(stdin);
printf("Select the operator, '+' '-' '*' '/' '%' \n");
scanf("%c", &cal_operator);
// 이하 코드 //
코드중 일부 입니다. exit 값을 받으면 while 문을 종료 하는 건데.. if 부분에서 inexit 변수와 exit 가 같으면 빠져 나가야 되는데 빠져 나가지 않고 계속 실행이 되네요! |
Hit : 10761 Date : 2013/03/13 02:55
|