竞赛
考级
#include <bits/stdc++.h> using namespace std; int isTdn(int n){//is Two-dight number cin>>n; if(n<10||n>99) { return 0; }//排除不可能 else if(n>10||n10) { if(n<99||n99) { return 1; } } } int main() { int n; if(isTdn(n)==1) { cout<<"yes"; }//是 else{ cout<<"no"; }//不是 return 0; }
三目运算一遍过
#include<bits/stdc++.h> using namespace std; int main(){ int a; cin>>a; if(a>=10&&a<=99) cout<<"yes"; else cout<<"no"; return 0; }
#include<bits/stdc++.h> using namespace std; // 完成判定是否是两位数的函数 调用函数解题 bool check(int x) { if(x/100!=0) return false; return true; } int main() { int n; cin>>n; if(check(n)) cout<<"yes"; else cout<<"no"; return 0; }
#include<iostream> using namespace std; int main(){ int n; cin>>n; if(n>=10 && n<=99){ cout<<"yes"<<endl; } else cout<<"no"<<endl; return 0; }
代码如下: 点点赞吧 祝你永远
提交答案之后,这里将显示提交结果~