作者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)