小陆所在的公司实行周末单双休,即一周只休周日,下一周休周六日,如此轮换。已知2016年8月13-14日是双休,输入年月日,以yyyymmdd的格式,如20160814,输出当天是否休息,(不考虑法定节假日)
要求:不能使用时间、日期相关的库函数
#include<iostream>
#include<string>
using namespace std;
int main(){
string inputString;
long date;
cin>> inputString;
int year,month,day;
int pos = 0;
//去除字符串中的逗号
while((pos=inputString.find(","))!=-1){
inputString.erase(pos,1);
}
//将字符串转换为10进制int型
date = stoi(inputString,0,10);
//从日期中提取年月日
year=date/10000;
month=date%10000/100;
day=date%100;
int weekAfter[7] = {
0,1,2,3,4,5,6}