C语言简单编程1、输入两个时间(
用C++写的,根C只在输入输出不一样,
第一题:
#include
using namespace std;
void main( )
{
int s1,s2,d;
int a[3];
int b[3];
cout>a[2];
cout>a[1];
cout>a[0];
cout>b[2];
cout>b[1];
cout>b[0];
s1=3600*a[2]+60*a[1]+a[0];
s2=3600*b[2]+60*b[1]+b[0];
if(s1>s2)
d=s1-s2;
else
d=s2-s1;
cout
using namespace std;
void main( )
{
i...全部
用C++写的,根C只在输入输出不一样,
第一题:
#include
using namespace std;
void main( )
{
int s1,s2,d;
int a[3];
int b[3];
cout>a[2];
cout>a[1];
cout>a[0];
cout>b[2];
cout>b[1];
cout>b[0];
s1=3600*a[2]+60*a[1]+a[0];
s2=3600*b[2]+60*b[1]+b[0];
if(s1>s2)
d=s1-s2;
else
d=s2-s1;
cout
using namespace std;
void main( )
{
int year,month,day;//出生年月日;
int year2;//要判断的真实年龄;
int year1;//实际年龄;
int y,m,d;//今天的日期;
cout>y;
cout>m;
cout>d;
cout>year;
cout>month;
cout>day;
cout>year2;
if(m>=month && d>=day)
year1=y-year;
else
year1=y-year-1;
if(year2==year1)
cout< 收起