问道c++题

来源:百度知道 编辑:UC知道 时间:2024/06/14 14:48:13
user输入Monday, January 1, 2001. 这样格式的文字
然后要求显示出:
January 1 was a Monday in 2001
Mon, Jan 1 '01
2001-01-01
求答案呀!!!!!!!!!!!!!!!!!!
谢谢!!!!!!!!!!!!!!

#include<iostream> 

#include<sstream>

using namespace std;

void main(){

 string week,month,year,temp;//周几?几月?哪年?中间变量;

 int day;               //第多少号?

 cin>>week>>month>>day>>year;

 

 cout<<month<<" "<<day<<" was a "<<week<<" in "<<year<<endl;

 if( "Monday"==week )

  cout<<"Mon,";

 else if( "Monday"==week )

  cout<<"Tue,";

 else if( "Wednesday"==week )

  cout<<"Wed,";

 else if( "Thursday"==week )

  cout<<"Th