题解
2023-08-17 11:43:38
发布于:广东
30阅读
0回复
0点赞
像这种题我们可以用switch来做,这用会更简洁
#include<iostream>
using namespace std;
int main(){
int n,t;
cin>>n;
n=(n+1)%7;
switch (n){
case 1:cout<<"monday";break;
case 2:cout<<"tuesday";break;
case 3:cout<<"wednesday";break;
case 4:cout<<"thursday";break;
case 5:cout<<"friday";break;
case 6:cout<<"saturday";break;
case 0:cout<<"sunday";break;
}
return 0;
}
全部评论 1
thinks!
2024-04-05 来自 广东
0
有帮助,赞一个