本文主要是介绍日期(贵州大学考研机试题,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
思路:阿巴阿巴
代码:
#include <iostream>
#include <cstring>
#include <algorithm>using namespace std;const int monthes[] = {0, 0, 0, 0, 30, 31, 30, 31, 31, 30, 31, 30, 31
};
int main()
{int month, date;cin >> month >> date;int m = 4, d = 12, day = 4;while (m < month || d < date){d ++;if (d > monthes[m]){d = 1;m ++;}day = (day + 1)% 7; }string ans[] = {"Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"};cout << ans[day] << endl;return 0;
}
这篇关于日期(贵州大学考研机试题的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!