蓝桥杯-每日刷题-024

一个星期有七天

一、问题要求

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

二、完整代码

#include 
#include 

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;
}

你可能感兴趣的:(蓝桥杯,c++,算法)