هدا الحل الي حليته
جربوا البرنامج وبيضبط معاكم
كود:
#include <stdio.h>
#include <conio.h>
#include <math.h>
#include <ctype.h>
#include <string.h>
int TimeToSecond (char time[])
{
int h=0,m=0,s=0;
h+=(time[0]-'0')*10;
h+=time[1]-'0';
m+=(time[3]-'0')*10;
m+=time[4]-'0';
s+=(time[6]-'0')*10;
s+=time[7]-'0';
s=s+(h*60*60)+(m*60);
return(s);
}
void main()
{
char time[8];
int s;
printf("Enter the time using the formula hh:mm:ss\n");
gets(time);
s=TimeToSecond(time);
printf("The time in seconds is : %d",s);
getch();
}