fork download
  1. #include <iostream>
  2.  
  3. int main()
  4. {
  5. const char s[] = "22/03/07,04:16:36+08";
  6.  
  7. int8_t y, m, d, hh, mm, ss, o;
  8.  
  9. if ( sscanf( s, "%hhd/%hhd/%hhd,%hhd:%hhd:%hhd%hhd", &y, &m, &d, &hh, &mm, &ss, &o ) == 7 )
  10. {
  11. printf( "%02hhd/%02hhd/%02hhd\n%02hhd:%02hhd:%02hhd\n%02hhd\n", y, m, d, hh, mm, ss, o );
  12. }
  13.  
  14. return 0;
  15. }
Success #stdin #stdout 0.01s 5512KB
stdin
Standard input is empty
stdout
22/03/07
04:16:36
08