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
热门推荐
10 孩子军训回家祝福语简短
11 生日祝福语男孩 简短独特
12 生日祝福语古朴简短独特
13 老师新婚快乐祝福语简短
14 元旦祝福语简短有深度
15 道教生日祝福语简短大全
16 哥哥结婚的祝福语简短
17 高考祝福语 简短12字
18 生日祝福语简短搞笑女儿