Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int srt()
- {
- int h1, h2, h3, h4, m1, m2, m3, m4, s1, s2, s3, s4, t1, t2, t3, t4, a=" ", b=" ", nr1, nr2, T1, T2, T3, T4, Td1, Td2, T, count=0;
- scanf("%d\n", &nr1);
- scanf("%d:%d:%d,%d %d:%d:%d,%d\n", &h1, &m1, &s1, &t1, &h2, &m2, &s2, &t2); //first starting and ending time
- scanf("%s", &a);
- printf("\n");
- count++;
- scanf("%d\n", &nr2);
- scanf("%d:%d:%d,%d %d:%d:%d,%d\n", &h3, &m3, &s3, &t3, &h4, &m4, &s4, &t4); //second starting and ending time
- scanf("%s", &b);
- printf("\n");
- count++;
- T1=t1+s1*1000+m1*60000+h1*3600000; // in milisecunde
- T2=t2+s2*1000+m2*60000+h2*3600000;
- T3=t3+s3*1000+m3*60000+h3*3600000;
- T4=t4+s4*1000+m4*60000+h4*3600000;
- Td1=T2-T1; //first displaying time
- Td2=T4-T3; //second displaying time
- T=Td1+Td2; //total displaying time
- printf("%d\n", count); //the number of subtitle groups
- printf("%02d:%02d:%02d,%03d\n", T/3600000, (T%3600000)/60000, (T%60000)/1000, (T%60000)%1000);
- }
- int main()
- {
- srt();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement