C ++ STL中的lldiv()函数
C++STL中的lldiv()函数给出两个数字的商和余数的结果。
算法
Begin Take two long type numbers as input. Call function lldiv(). Print the quotient and remainder. End.
范例程式码
#include <cstdlib>
#include <iostream>
using namespace std;
int main() {
long long q = 500LL;
long long r = 25LL;
lldiv_t res = lldiv(q, r);
cout << "Quotient of " << q << "/" << r << " = " << res.quot << endl;
cout << "Remainder of " << r << "/" << r << " = " << res.rem << endl;
return 0;
}输出结果
Quotient of 500/25 = 20 Remainder of 25/25 = 0
热门推荐
1 短祝福语简短暖心
8 修祖屋祝福语简短
10 女生成年祝福语简短
11 龙年简短祝福语有哪些
12 女生 节日祝福语简短大气
13 叔叔生日祝福语简短励志
14 好听的元旦简短祝福语
15 奶奶生日感恩祝福语简短
16 情人表白祝福语简短大气
17 参加儿子大学祝福语简短
18 春季祝福语女生文案简短