1
#include<iostream>
using namespace std;
int main()
{
int t;
cin>>t;
if(t>=30 && t<=20)
{
cout<<"ok";
}
else
{
cout<<"no";
}
return 0;
}
2
#include<iostream>
using namespace std;
int main()
{
int a,b,c;
cin>>a>>b>>c;
if(a+b>c && b+c>a && a+c>b)
{
cout<<"yes";
}
else
{
cout<<"no";
}
return 0;
}
文章展示了两个C++程序片段,分别使用if-else结构进行条件判断(第一个是年龄在30到20之间的测试,第二个是检查三个整数是否构成三角形),演示了基本的输入输出和逻辑比较。

被折叠的 条评论
为什么被折叠?



