一个C程序纠错!急!!!!

来源:百度知道 编辑:UC知道 时间:2024/06/16 23:50:25
#include <stdio.h>
#include <math.h>
#define AHOUR 3600

/*Function to judge the input whether legal */
int judge( int h, int m, int s)
{
if( h>23 || m>59 || s>59 || h<0 || m<0 || s<0)
return 0;
else
return 1;
}

/*Function to determine the number of seconds between the two time*/
int seconds( int h1, int m1, int s1, int h2, int m2, int s2)
{
int h;
int scs1,scs2;
int i;

h = ( h1 < h2 ) ? h1 : h2;

scs1 = s1;

for( i=h; i<h1; i++ )
scs1 += AHOUR;

for( i=0; i<m1; i++ )
scs1 += 60;

scs2 = s2;
for( i=h; i<h2; i++ )
scs2 += AHOUR;

for( i=0; i<m2; i++ )
scs2 += 60;

return abs( scs1-scs2 );
}

void main()
{
int h1,m1,s1,h2,m2,s2;

printf("Program seconds calculates the number of seconds betwee

#include <stdio.h>
#include <math.h>
#define AHOUR 3600

/*Function to judge the input whether legal */
int judge( int h, int m, int s)
{
if( h>23 || m>59 || s>59 || h<0 || m<0 || s<0)
return 0;
else
return 1;
}

/*Function to determine the number of seconds between the two time*/
int seconds( int h1, int m1, int s1, int h2, int m2, int s2)
{
// int h;
int scs1,scs2;
int i;

// h = ( h1 < h2 ) ? h1 : h2;

scs1 = s1;

for( i=0; i<h1; i++ )
scs1 += AHOUR;

for( i=0; i<m1; i++ )
scs1 += 60;

scs2 = s2;
for( i=0; i<h2; i++ )
scs2 += AHOUR;

for( i=0; i<m2; i++ )
scs2 += 60;

return abs( scs1-scs2 );
}

void main()
{
int h1,m1,s1,h2,m2,s2;

printf("Program seconds calculates the number of sec