题解 AT4278 【[ABC115A] Christmas Eve Eve Eve】

题目传送门


分析

根据题目,我们可以发现要求如下:

(d)的值 输出
(d=25) Christmas
(d=24) Christmas Eve
(d=23) Christmas Eve Eve
(d=22) Christmas Eve Eve Eve

因此,我们只需要使用(4)if语句解决即可。


解题步骤

  1. 定义变量(d),并输入。
	int d;
	cin>>d;
  1. 使用(4)if语句判断(d)的值,并输出对应的内容。
	if(d==25)cout<<"Christmas";
	if(d==24)cout<<"Christmas Eve";
	if(d==23)cout<<"Christmas Eve Eve";
	if(d==22)cout<<"Christmas Eve Eve Eve"; 

代码

#include <bits/stdc++.h>
using namespace std;
int main()
{
	int d;
	cin>>d;
	if(d==25)cout<<"Christmas";
	if(d==24)cout<<"Christmas Eve";
	if(d==23)cout<<"Christmas Eve Eve";
	if(d==22)cout<<"Christmas Eve Eve Eve"; 
    return 0;
}
原文地址:https://www.cnblogs.com/tearing/p/12376380.html