作者ric2k1 (Ric)
看板EE_DSnP
标题[情报] 期末考示范考题 (一)
时间Sun Jan 13 22:50:44 2008
(Note: This program is to compare the modulus of two integers)
Please point out the only ONE compilation error of the following program.
Please explain why and suggest a way to fix it.
=========================================================================
#include <iostream>
#include <iomanip>
using namespace std;
#define MOD 8
bool operator < (const int a, const int b)
{
return ((a % MOD) < (b % MOD));
}
int main()
{
int a = 20;
int b = 30;
cout << boolalpha << (a < b) << endl;
return 0;
}
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 59.121.135.175
1F:→ ric2k1:这题难易度是: 中等. 01/13 22:59
※ 编辑: ric2k1 来自: 59.121.135.175 (01/13 23:40)