problemscpp
A collection of my answers to algorithm problems in c++.
静态 Public 成员函数 | 所有成员列表
acwing::acwing656类 参考

AcWing 656. 钞票和硬币 更多...

#include <acwing.h>

静态 Public 成员函数

static int main (istream &, ostream &)
 

详细描述

AcWing 656. 钞票和硬币

在文件 acwing.h323 行定义.

成员函数说明

◆ main()

int acwing::acwing656::main ( istream &  cin,
ostream &  cout 
)
static

在文件 acwing.cpp814 行定义.

814 {
815 double n;
816 cin >> n;
817 int total = static_cast<int>(n * static_cast<double>(100));
818 const int denominations[] = {10000, 5000, 2000, 1000, 500, 200, 100, 50, 25, 10, 5, 1};
819 int count[12];
820 for(int i = 0; i < 12; i++) {
821 count[i] = total / denominations[i];
822 total %= denominations[i];
823 }
824 cout << "NOTAS:" << endl
825 << count[0] << " nota(s) de R$ 100.00" << endl
826 << count[1] << " nota(s) de R$ 50.00" << endl
827 << count[2] << " nota(s) de R$ 20.00" << endl
828 << count[3] << " nota(s) de R$ 10.00" << endl
829 << count[4] << " nota(s) de R$ 5.00" << endl
830 << count[5] << " nota(s) de R$ 2.00" << endl
831 << "MOEDAS:" << endl
832 << count[6] << " moeda(s) de R$ 1.00" << endl
833 << count[7] << " moeda(s) de R$ 0.50" << endl
834 << count[8] << " moeda(s) de R$ 0.25" << endl
835 << count[9] << " moeda(s) de R$ 0.10" << endl
836 << count[10] << " moeda(s) de R$ 0.05" << endl
837 << count[11] << " moeda(s) de R$ 0.01";
838 return 0;
839 }

被这些函数引用 acwing::TEST().


该类的文档由以下文件生成: