求c语言高手帮助编程 多多给分
#include "stdafx.h"
int leap_year(int year) //判断是否为闰年
{
if (((year%4==0)&&(year%100!=0) )||(year%400==0))
return 1;
else
return 0;
}
int get_count_day(int year,int month,int day)
{
int count = 1;
int two = 28;
if (leap_year(year)==1) //该年为闰年,二月则有29天
two = 29;
switch(month)
{
case 1:
count = day;
break;
case 2:
count = 31 + day;
break;
case 3:
count = 31 + two + day;
break;
case 4:
count = 31 + two + 31 + day;
break;
case 5:
count = 31 + two + 31 + 30 + day;
break;
case 6:
count = 31 + two + 31 + 30 + 31 + day;
break;
case 7:
count = 31 + two + 31 + 30 + 31 + 30 + day;
break;
case 8:
count = 31 + two + 31 + 30 + 31 + 30 + 31 + day;
break;
case 9:
count = 31 + two + 31 + 30 + 31 + 30 + 31 + 31 + day;
break;
case 10:
count = 31 + two + 31 + 30 + 31 + 30 + 31 + 31 + 30 + day;
break;
case 11:
count = 31 + two + 31 + 30 + 31 + 30 + 31 + 31 + 30 + 31 + day;
break;
case 12:
count = 31 + two + 31 + 30 + 31 + 30 + 31 + 31 + 30 + 31 + 30 + day;
break;
}
return count;
}
int main(int argc, char* argv[])
{
int year,month,day,count;
printf("please input date:
");
scanf("%d%d%d",&year,&month,&day);
count = get_count_day(year,month,day);
printf("%d-%d is the %d day in %d!
",month,day,count,year);
return 0;
}
发到你邮箱了,有点晚啊,不好意思,嘿嘿!
#include<stdio.h>#define pi 3.14159265
main()
{
float r,h,c,s,t,v;
printf("请输入底面圆的半径:");
scanf("%f",&r);
printf("请输入圆柱的高:");
scanf("%f",&h);
c=2*pi*r;
s=pi*r*r;
t=2*s+c*h;
v=s*h;
printf("圆的周长%.2f\n",c);
printf("圆的面积%.2f\n",s);
printf("圆柱的表面积%.2f\n",t);
printf("圆柱的体积%.2f\n",v);
}
#include<stdio.h>
#define pi 3.1416
main()
{
float r,h;
printf("请输入底面圆的半径圆柱的高:(以逗号隔开)");
scanf("%f,%f",&r,&h); //从键盘获得半径和高
printf("圆周长为:%.2f\n",2*pi*r); //根据计算公式得到周长
printf("圆面积为:%.2f\n",pi*r*r); //
printf("圆柱表面积为:%.2f\n",2*s+c*h);//
printf("圆柱体积为:%.2f\n",s*h); //
}
回答者: chonger001 - 助理 二级 -->>> 你确实有点懒哟!!!
#include<stdio.h>
#define pi 3.14159265
main()
{
float r,h,c,s,t,v;
printf("请输入底面圆的半径:");
scanf("%f",&r);
printf("请输入圆柱的高:");
scanf("%f",&h);
c=2*pi*r;
s=pi*r*r;
t=2*s+c*h;
v=s*h;
printf("圆的周长%.2f\n",c);
printf("圆的面积%.2f\n",s);
printf("圆柱的表面积%.2f\n",t);
printf("圆柱的体积%.2f\n",v);
}
回答者: xinyiran1205 - 江湖少侠 六级 10-27 12:01
#include<stdio.h>
#define pi 3.1416
main()
{
float r,h;
printf("请输入底面圆的半径圆柱的高:(以逗号隔开)");
scanf("%f,%f",&r,&h); //从键盘获得半径和高
printf("圆周长为:%.2f\n",2*pi*r); //根据计算公式得到周长
printf("圆面积为:%.2f\n",pi*r*r); //
printf("圆柱表面积为:%.2f\n",2*s+c*h);//
printf("圆柱体积为:%.2f\n",s*h); //
}
参考资料:It's easy!
回答者: czgxhf - 助理 二级 10-27 14:05
太懒了
相关视频