#include<stdio.h>
#pragma warning(disable:4996)
int ADD( int operand1, int operand2 );
int ADD( int operand1, int operand2 )
{
return operand1 + operand2; // 대입은 왜 하냐구 걍 더하면 되지
}
int main()
{
char command;
int operand, result; // 덧셈만 할 것은 아니잖아?
scanf( "%c", &command );
switch(command)
{
case '+':
scanf( "%d", &result );
while( 1 )
{
scanf( "%d", &operand );
if( operand == 0 ) break;
result = ADD( result, operand );
printf( "%d\\n", result );
}
break;
}
return 0;
}
프로그래밍을 이렇게하는사람이있다니 신기합니다
응? 뭐가 신기?
아래 아해 코드에 최대한 안바꾸고 돌아가게 만든건뎅.
아 설계는 아해가했군여 저 아해 덧셈참 신기하게하네요 ㅋㅋ
ㅋㅋ 내가 만들면 입력도 저렇게는 안 받지;
post-fix, in-fix, pre-fix 만 알아도 이건 좀 아닌 구조.
감사합니다!!!