64,649
社区成员
发帖
与我相关
我的任务
分享
opt = new char[count];
for(int i=0; i<count; i++)
opt[i] = 0;
#include <string>
#include <iostream>
using namespace std;
int main(int argc, char* argv[])
{
int count = 23;
char* opt;
cout<<"count:";
cin>>count;
opt = new char[count];
for(int i=0; i<count; i++)
opt[i] = 0;
int count_RMB =0;//翻人民币的次数。
count_RMB = count/5;
switch(count%5)
{
case 1:
count_RMB += 1;
break;
case 2:
count_RMB += 2;
break;
case 3:
count_RMB += 1;
break;
case 4:
count_RMB += 2;
break;
default:
break;
}
cout<<"硬币个数:"<<count<<endl;
cout<<"翻币次数:"<<count_RMB<<endl;
return 0;
}