1.2 判断语句笔记
# include <cstdio>
# include <iostream>
using namespace std;
int main ()
{
int year;
cin >> year;
if(year % 100 == 0 && year % 400 == 0 || year % 100 //不等于零,不被100整除,可以不写!= 0//
&& year % 4 == 0)
cout << "yes" << endl;
else cout << "no" << endl;
return 0;
}
#include <cstdio>
int main()
{
double salary;
scanf("%lf", &salary);
double x;
if (salary <= 400) x = 0.15;
else if (salary <= 800) x = 0.12;// 0-400;400-800这样写简洁 //
else if (salary <= 1200) x = 0.1;
else if (salary <= 2000) x = 0.07;
else x = 0.04;
printf("Novo salario: %.2lf\n", salary * (1 + x));
printf("Reajuste ganho: %.2lf\n", salary * x);
printf("Em percentual: %.0lf %%", x * 100);// %%是%的转义,比较特殊 //
return 0;
}