[C] #define 매크로를 활용한 사칙연산 계산기
#include #pragma warning(disable:4996) #define ADD(x,cal,y) printf("%d %c %d = %d\n",(x),(cal),(y) ,(x+y)) #define MUL(x,y) ((x)*(y)) #define SUB(x,y) ((x)-(y)) #define DIV(x,y) ((x)/(y)) #define input_expression(x,cal,y) scanf("%d %c %d",&(x),&(cal),&(y)) int main(void) { int sel = 0; int num1, num2; char cal; while(1) { printf("수식입력(종료:ctrl+z): "); if (input_expression(num1, cal, num2) < 0) { ..
2023. 10. 14.