fork(1) download
  1. #include <iostream>
  2. #include <sstream>
  3. #include <string>
  4. #include <ctime>
  5.  
  6. int dayOfWeek(std::string date){
  7. int y, m, d; char c;
  8. std::stringstream(date) >> y >> c >> m >> c >> d;
  9. std::tm t = {0,0,0,d,m-1,y-1900};
  10. std::mktime(&t);
  11. return t.tm_wday;
  12. }
  13.  
  14. int main()
  15. {
  16. std::cout << dayOfWeek("2015-11-27");
  17. }
Success #stdin #stdout 0s 3416KB
stdin
Standard input is empty
stdout
5