1.基础题
#include<iostream>
using namespace std;
int main()
{
int i=5,sum=0;
do
{
sum+=i;
i+=5;
}while(i<=200);
cout<<sum<<endl;
return 0;
}
A.输出5+10+15+20.....+200的和
B.输出2+4+6+8.....+20的和
C.输出10+20+30+40.....+200的和
2.易错题
#include<iostream>
#include<cmath>
using namespace std;
int main()
{
double x,y;
long long num;
do
{
cin>>x;
}while(x>=1||x<=0);
num=1;
do
{
num*=10;
y=x*num;
}while(fabs(y-(int)y)>1e-9);
cout<<int(y)<<endl;
return 0;
}
A.输入0.125,输出1.25
B.输入0.125,输出12.50
C.输入0.125,输出125
3.真·送分题
#include<iostream>
#include<cstdio>
using namespace std;
int main()
{
char ch;
bool f=false;
int num=0;
while((ch=getchar())!='\n')
{
if(f)
if(ch>='0'&&ch<='9')
num++;
else break;
if(ch=='.')f=true;
}
if(num>0)
cout<<num<<endl;
else
cout<<"输入不正确!"<<endl;
return 0;
}
A.输出小数点后数字的位数
B.输出小数点后的数
C.输出小数点前的数
别瞎蒙,写好题号,回帖一下我,好不容易找的题,不要白费我的心血呀!
全部评论
(2) 回帖