娄三飘
2018-12-30 15:18
#include <stdio.h>
int main()
{
//定义变量
int distance=12;
int Time=8;
float cost;
if (Time>=23||Time<=5)
{
cost=14+2.3*1.2*distance;
}
else
{
cost=14+2.3*distance;
}
if (distance<=3)
{
cost=14;
}
if (Time>=12)
{
Time=Time-12;
}
printf("小明%d点上班要花%.2f元钱", Time, cost);
return 0;
}
{
tm* pt;
time_t t=time(0);
pt=localtime(&t);
if(pt->tm_hour<12)
printf("现在是上午:%d:%d\n",pt->tm_hour,pt->tm_min);
else
printf("现在是下午:%d:%d\n",pt->tm_hour,pt->tm_min);
}
C语言入门
926212 学习 · 20797 问题
相似问题