📄 program5.c
字号:
#include "libepc.h"
typedef long long int INT64 ;
typedef struct TESTCASE
{
INT64 multiplier ;
INT64 multiplicand ;
} TESTCASE ;
INT64 Product(INT64, INT64) ;
void PutINT64(INT64) ;
int main()
{
static TESTCASE tc[] =
{
{+12345678ll, +90123456ll},
{+78901234ll, -56789012ll},
{-34567890ll, +13579024ll},
{-68135790ll, -24681357ll}
} ;
int i, row, col ;
ClearScreen(0x07) ;
row = 5 ; col = 18 ;
for (i = 0; i < ENTRIES(tc); i++)
{
INT64 multiplier, multiplicand, gccs, mine ;
multiplier = tc[i].multiplier ;
multiplicand = tc[i].multiplicand ;
gccs = multiplier * multiplicand ;
mine = Product(multiplier, multiplicand) ;
SetCursorPosition(row++, col) ;
PutString("Case #") ;
PutUnsigned(i, 10, 0) ;
PutString(": ") ;
PutINT64(multiplier) ;
PutString(" * ") ;
PutINT64(multiplicand) ;
SetCursorPosition(row++, col) ;
PutString("gcc's Answer: ") ;
PutINT64(gccs) ;
SetCursorPosition(row++, col) ;
PutString(" My Answer: ") ;
PutINT64(mine) ;
if (mine == gccs) PutString(" CORRECT!") ;
else PutString(" Oops! Try again.") ;
row++ ;
}
return 0 ;
}
void PutINT64(INT64 a)
{
if (a == 0x8000000000000000ll)
{
PutString("-9223372036854775808") ;
return ;
}
if (a < 0)
{
PutChar('-') ;
a = -a ;
}
if (a >= 10) PutINT64(a / 10) ;
PutChar('0' + (char) (a % 10)) ;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -