题目描述
/和%
转化为 int 来做
C++ 代码
#include <iostream>
#include <cstring>
#include <algorithm>
using namespace std;
int main()
{
double m;
cin >> m;
int n =m*100;
int a[]={10000,5000,2000,1000,500,200};
cout << "NOTAS:"<<endl;
for (int i = 0; i < 6; i ++ ){
printf("%d nota(s) de R$ %d.00\n",n/a[i],a[i]/100);
n%=a[i];
}
printf("MOEDAS:\n");
int b[]={100,50,25,10,5,1};
for (int j = 0; j < 6; j ++ ){
printf("%d moeda(s) de R$ %.2lf\n",n/b[j],b[j]/100.);
n%=b[j];
}
return 0;
}
```