蓝桥杯-每日刷题-024

一个星期有七天

一、问题要求

  • 题目描述
    为了学英语,小聪做了很多卡片。其中有七张卡片,一面是数字1、2、3、4、5、6、7,另一面分别是monday、tuesday、wednesday、thursday、friday、saturday、sunday.请你对任意的数字,输出相应的英文星期。
  • 输入格式
    输入有若干行,每行一个整数(1~7)。
  • 输出格式
    对应输出相应的星期。
  • 输入样例
    2
    4
    5
  • 输出样例
    tuesday
    thursday
    friday

二、完整代码

cpp 复制代码
#include <iostream>
#include <string>

std::string Ruturn(int x)
{
    if (x == 1)
        return "monday";
    else if (x == 2)
        return "tuesday";
    else if (x == 3)
        return "wednesday";
    else if (x == 4)
        return "thursday";
    else if (x == 5)
        return "friday";
    else if (x == 6)
        return "saturday";
    else if (x == 7)
        return "sunday";
}
int main() {
    int x;
    while(std::cin>>x)
    {
        std::string r = Ruturn(x);
        std::cout << r << std::endl;
    }
    return 0;
}
相关推荐
OrangeJiuce28 分钟前
【QT中的一些高级数据结构,持续更新中...】
数据结构·c++·qt
程序员-King.3 小时前
【接口封装】——13、登录窗口的标题栏内容设置
c++·qt
学编程的小程3 小时前
LeetCode216
算法·深度优先
leeyayai_xixihah3 小时前
2.21力扣-回溯组合
算法·leetcode·职场和发展
01_3 小时前
力扣hot100——相交,回文链表
算法·leetcode·链表·双指针
萌の鱼3 小时前
leetcode 2826. 将三个组排序
数据结构·c++·算法·leetcode
Buling_03 小时前
算法-哈希表篇08-四数之和
数据结构·算法·散列表
AllowM3 小时前
【LeetCode Hot100】除自身以外数组的乘积|左右乘积列表,Java实现!图解+代码,小白也能秒懂!
java·算法·leetcode
RAN_PAND4 小时前
STL介绍1:vector、pair、string、queue、map
开发语言·c++·算法