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
热门推荐
9 天仙配简短祝福语
10 元旦祝福语 简短独特群发
11 生日摆摊祝福语简短独特
12 集体年会祝福语简短创意
13 宝贝生日祝福语简短独特
14 虎年贺卡和祝福语简短
15 送病人简短的祝福语
16 结婚伴娘祝福语简短精辟
17 国庆祝福语简单简短
18 给孩子开学祝福语简短