你写的真的有些太麻烦了,好好学吧,一定要多动脑筋去省!!!!去简化!!!!
include[HTML_REMOVED]
using namespace std;
int main()
{
int n,a,b,c,d,e,f,g;
cin>>n;
a=n/100;
b=n%100/50;
c=n%100%50/20;
d=n%100%50%20/10;
e=n%100%50%20%10/5;
f=n%100%50%20%10%5/2;
g=n%100%50%20%10%5%2/1;
printf(“%d\n”,n);
printf(“%d nota(s) de R$ 100,00\n”,a);
printf(“%d nota(s) de R$ 50,00\n”,b);
printf(“%d nota(s) de R$ 20,00\n”,c);
printf(“%d nota(s) de R$ 10,00\n”,d);
printf(“%d nota(s) de R$ 5,00\n”,e);
printf(“%d nota(s) de R$ 2,00\n”,f);
printf(“%d nota(s) de R$ 1,00\n”,g);
return 0;
}
简化方法之一:
printf(“%d 100”,n/100);
n=n%100 //n%=100更简单!
printf(“%d 50”,n/50);
n%=50
````