#include<stdio.h>
int add(int x, int y) { // 덧셈연산
int result;
result = x + y;
return result;
}
int del(int x, int y) { // 뺄셈연산
int result;
result = x - y;
return result;
}
int multiply(int x, int y) { // 곱셈 연산
int result;
result = x * y;
return result;
}
double division(int x, int y) { // 나눗셈 연산
double result;
result = x / y;
return result;
}
int main(void) {
int x, y, result, signal;
printf("enter the two number : \n"); // 정수 입력문
scanf_s("%d %d", &x, &y); // 정수 값 입력 받고
printf(" please choice (+,-,*,/) \n"); // 연산 입력문
scanf_s("%c", &signal); // 연산 입력
swich(signal)
{
case: '+' :
printf("Your choice is ADD");
result = add(x, y);
printf("%d + %d = %d", x, y, result);
case: '-' :
printf("Your choice is DEL");
result = del(x, y);
printf("%d -%d = %d", x, y, result);
case: '*' :
printf("Your choice is MULTIPLY");
result = multiply(x, y);
printf("%d * %d = %d", x, y, result);
case: '/' :
printf("Your choice is DIVISION");
result = division(x, y);
printf("%d / %d = %d", x, y, result);
}
return 0;
}
컴파일 돌리면 스위치문이 선언되지 않았다고 나오면서 컴파일 에러 뜨는데
어디가 틀린건지요 ㅠㅠ
switch 아님?