c언어 수정좀 부탁드립니다.
조회수 646회
제가 짠 코드인데요 디버깅을 했을 때 컴퓨터가 if부분에 영향을 받지 않고 그냥 쭉 실행나가더라구요 어느부분이 문제일까요....?
#include<string.h>
#include<stdio.h>
#include<stdlib.h>
int main(void)
{
char str1[10];
char str2[10];
char str3[10];
int num1, res;
printf("0P #1 : ");
scanf("%s", str1);
while (str1[0] != '0')
{
printf("OPER : ");
scanf("%s", str2);
printf("OP #2 : ");
scanf("%s", str3);
if (str2[0] == '@')
{
strcat(str1, str3);
num1 = atoi(str1);
res = num1 + 1;
printf("result : %d\n", res);
}
else
{
strcat(str3, str1);
num1 = atoi(str3);
res = num1 - 1;
printf("result : %d\n", res);
}
}
return 0;
}
-
(•́ ✖ •̀)
알 수 없는 사용자 - 〉
댓글 입력