标签:++ ffffff 问题 pre font input 图片 cin 技术
题目
和数书页有点类似,就直接数吧
#include<iostream>
using namespace std;
class q1
{
public:
size_t func(size_t num);
};
size_t q1::func(size_t num)
{
size_t count = 0, tmp;
while(num)
{
tmp = num;
while(tmp)
{
if(tmp%10 == 1)
++count;
tmp = tmp/10;
}
--num;
}
return count;
}
int main()
{
q1 an;
size_t num = 0;
while(1)
{
cout<<"please input positive integer: ";
cin>>num;
cout<<num<<" to 0 include "<<an.func(num)<<" number 1 ."<<endl;
}
//num = 0xffffffff;
//cout<<num<<" to 0 include "<<an.func(num)<<" number 1 ."<<endl;
}
可循环输入,运行效果
问题2
标签:++ ffffff 问题 pre font input 图片 cin 技术
原文地址:https://www.cnblogs.com/area-h-p/p/11791337.html