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 出国贺卡祝福语大全简短
18 对转岗同学祝福语简短