3086【例16.1】 判断数正负
#include<bits/stdc++.h>
using namespace std;
int main()
{
int a;
cin>>a;
if(a > 0)
cout<<"positive";
else if(a < 0)
cout<<"negative";
else
cout<<"zero";
return 0;
}
3087【例16.2】 开灯
#include <iostream>
using namespace std;
int main(){
int m;
cin >> m;
cout << m % 2 << endl;
return 0;
}
3088【例16.3】 收费
#include<bits/stdc++.h>
using namespace std;
int main()
{
double a, r;
cin >> a;
if(a <= 20)
r = a*1.68;
else
r = a*1.98;
cout << fixed << setprecision(2) << r;
return 0;
}
3089练16.1 跳绳达人
#include<bits/stdc++.h>
using namespace std;
int main()
{
int a,s;
cin>>a;
if(a>=200)
{
cout<<"跳绳达人!"<<endl;
}
else
{
cout<<"继续努力!"<<endl;
}
return 0;
}
3090练16.2 奇偶数判断
#include<bits/stdc++.h>
using namespace std;
int main()
{
int n;
cin>>n;
if(n % 2 == 0)
cout<<"even";
else
cout<<"odd";
return 0;
}
3091练16.3 选择题判定
#include<bits/stdc++.h>
using namespace std;
int main()
{
int c = 150;
string n;
cin >> n;
string m = "DCBAD";
for(int i = 0; i <= 4; i++)
{
if(n[i] != m[i])
{
c -= 30;
}
}
cout << c << endl;
return 0;
}