C++课程中的第三项函数实验
发布时间
阅读量:
阅读量
文章结构概览
- 应用题1
- 应用题2
- 应用题3
- 应用题4
- 应用题5
实践题1
问题描述
#include<iostream>
using namespace std;
bool f(long x)
{
int temp;
bool flag = true;
while(x/10!=0)
{
temp=x%10;
if(temp%2!=0) return !flag;
x/=10;
}
if(x%2!=0) return !flag;
return flag;
}
int main()
{
long a;
cin >> a;
if(f(a)) cout << "true";
else cout << "false";
return 0;
}
全部评论 (0)
还没有任何评论哟~
