fork(2) download
  1. #include <iostream>
  2.  
  3. int main()
  4. {
  5. int d;
  6. int m;
  7. int y;
  8. std::cin >> d; // read the day
  9. if ( std::cin.get() != '/' ) // make sure there is a slash between DD and MM
  10. {
  11. std::cerr << "expected /\n";
  12. return 1;
  13. }
  14. std::cin >> m; // read the month
  15. if ( std::cin.get() != '/' ) // make sure there is a slash between MM and YYYY
  16. {
  17. std::cerr << "expected /\n";
  18. return 1;
  19. }
  20. std::cin >> y; // read the year
  21. std::cout << "input date: " << d << "/" << m << "/" << y << "\n";
  22. }
Success #stdin #stdout 0s 3344KB
stdin
30/06/2014
stdout
input date: 30/6/2014