답안 #16954

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
16954 2015-11-02T08:36:47 Z taehoon1018 MathWorlds (YDX13_mathworlds) C++
컴파일 오류
0 ms 0 KB
int main(void)
{
	int x, y, z, count = 0;
	char ch;

	scanf("%d%d%d", &x, &y, &z);

	if (x + y == z)
	{
		count++;
		ch = '+';
	}
	if (x - y == z)
	{
		ch = '-';
		count++;
	}
	if (x*y == z)
	{
		ch = '*';
		count++;
	}
	if (x / (float)y == z)
	{
		if (y != 0)
		{
			count++;
			ch = '/';
		}
	}

	if (count == 1)
		printf("%c", ch);
	else
		printf("Invalid");

}

Compilation message

D.cpp: In function ‘int main()’:
D.cpp:7:28: error: ‘scanf’ was not declared in this scope
  scanf("%d%d%d", &x, &y, &z);
                            ^
D.cpp:34:18: error: ‘printf’ was not declared in this scope
   printf("%c", ch);
                  ^
D.cpp:36:19: error: ‘printf’ was not declared in this scope
   printf("Invalid");
                   ^