sp; {
a=i/100;
b=____________; // (1)
c=____________; // (2)
if (a==b || a==c || b==c)
____________; // (3)
cout<<i<<" ";
cnt++;
}
cout<<endl<<cnt<<endl;
return 0;
}
9.将100元换成10元、5元和1元的组合,共有多少种组合方法。
#include <iostream>
using namespace std;
int main()
{
int i,j,k,count=0; // i是10元张数,j是5元张数,k是1元张数
for (i=0; ___________; i++) // (1)
for (j=0; ___________ ; j++) // (2)
{
k= ___________ ; // (3)
cout<<i<<'\t'<<j<<'\t'<<k<<endl;
count++;
}
cout<<count<<endl;
return 0;
}
10.用1元人民币兑换成1分、2分、5分,共有多少种不同的兑换方法。
#include <iostream>
using namespace std;
int main()
{
int five,two,count=0;
for (five=0;five<=__________;five++) // (1)
for (two=0; two<=__________;two++) // (2)
count++;
cout<< "共有 " << count << " 种兑换方法" <<endl;
return 0;
}
11.从键盘输入一个非负整数,将它反向显示出来。例如,输入1234,输出4321。
#include <iostream>
using namespace std;
int main()
{
int number,digit;
cin>>number;
cout<< number <<" 的逆序数为 ";
do {
digit=_________________________; // (1)
number=________________________; // (2)
cout<<digit;
} while (______________________); // (3)
cout<<endl;
return 0;
}
&n