fork download
  1. #include <iostream>
  2.  
  3. int main()
  4. {
  5. char str[] = "21:03:33 , 28";
  6.  
  7. int hour = atoi(str);
  8. int minute = atoi(str+3);
  9. int second = atoi(str+6);
  10. int temperature = atoi(str+11);
  11.  
  12. printf("hour = %d, minute = %d, second = %d, temperature = %d\n", hour, minute, second, temperature);
  13.  
  14. return 0;
  15. }
Success #stdin #stdout 0s 4488KB
stdin
Standard input is empty
stdout
hour = 21, minute = 3, second = 33, temperature = 28