欢迎来到天天文库
浏览记录
ID:62035653
大小:34.00 KB
页数:9页
时间:2021-04-15
《日出日落时间计算程序(C语言).doc》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、//日出日落时间计算C语言程序#definePI3.1415926#include#includeusingnamespacestd;intdays_of_month_1[]={31,28,31,30,31,30,31,31,30,31,30,31};intdays_of_month_2[]={31,29,31,30,31,30,31,31,30,31,30,31};longdoubleh=-0.833;//定义全局变量voidinput_date(intc[]){inti;cout<<"Enterthedate(form:20090310):"<
2、>c[i];}}//输入日期voidinput_glat(intc[]){inti;cout<<"Enterthedegreeoflatitude(range:0°-60°,form:404040(means40°40′40″)):"<>c[i];}}//输入纬度voidinput_glong(intc[]){inti;cout<<"Enterthedegreeoflongitude(westisnegativ,form:404040(means40°40′40″)):"<3、ndl;for(i=0;i<3;i++){cin>>c[i];}}//输入经度intleap_year(intyear){if(((year%400==0)4、5、(year%100!=0)&&(year%4==0)))return1;elsereturn0;}//判断是否为闰年:若为闰年,返回1;若非闰年,返回0intdays(intyear,intmonth,intdate){inti,a=0;for(i=2000;i6、1;i++){a=a+days_of_month_2[i];}}else{for(i=0;i7、60+36000.770*t_century);}//求太阳的平黄径longdoubleG_sun(longdoublet_century){return(357.528+35999.050*t_century);}//求太阳的平近点角longdoubleecliptic_longitude(longdoubleL_sun,longdoubleG_sun){return(L_sun+1.915*sin(G_sun*PI/180)+0.02*sin(2*G_sun*PI/180));}//求黄道经度longdoubleearth_tilt(longdoublet_century){re8、turn(23.4393-0.0130*t_century);}//求地球倾角longdoublesun_deviation(longdoubleearth_tilt,longdoubleecliptic_longitude){return(180/PI*asin(sin(PI/180*earth_tilt)*sin(PI/180*ecliptic_longitude)));}//求太阳偏差longdoubleGHA(longdoubleUTo,longdoubleG_sun,longdoubleecliptic_longitude){return(UTo-180-1.915*sin9、(G_sun*PI/180)-0.02*sin(2*G_sun*PI/180)+2.466*sin(2*ecliptic_longitude*PI/180)-0.053*sin(4*ecliptic_longitude*PI/180));}//求格林威治时间的太阳时间角GHAlongdoublee(longdoubleh,longdoubleglat,longdoublesun_deviation){return180/PI*acos((sin(h*PI/
3、ndl;for(i=0;i<3;i++){cin>>c[i];}}//输入经度intleap_year(intyear){if(((year%400==0)
4、
5、(year%100!=0)&&(year%4==0)))return1;elsereturn0;}//判断是否为闰年:若为闰年,返回1;若非闰年,返回0intdays(intyear,intmonth,intdate){inti,a=0;for(i=2000;i6、1;i++){a=a+days_of_month_2[i];}}else{for(i=0;i7、60+36000.770*t_century);}//求太阳的平黄径longdoubleG_sun(longdoublet_century){return(357.528+35999.050*t_century);}//求太阳的平近点角longdoubleecliptic_longitude(longdoubleL_sun,longdoubleG_sun){return(L_sun+1.915*sin(G_sun*PI/180)+0.02*sin(2*G_sun*PI/180));}//求黄道经度longdoubleearth_tilt(longdoublet_century){re8、turn(23.4393-0.0130*t_century);}//求地球倾角longdoublesun_deviation(longdoubleearth_tilt,longdoubleecliptic_longitude){return(180/PI*asin(sin(PI/180*earth_tilt)*sin(PI/180*ecliptic_longitude)));}//求太阳偏差longdoubleGHA(longdoubleUTo,longdoubleG_sun,longdoubleecliptic_longitude){return(UTo-180-1.915*sin9、(G_sun*PI/180)-0.02*sin(2*G_sun*PI/180)+2.466*sin(2*ecliptic_longitude*PI/180)-0.053*sin(4*ecliptic_longitude*PI/180));}//求格林威治时间的太阳时间角GHAlongdoublee(longdoubleh,longdoubleglat,longdoublesun_deviation){return180/PI*acos((sin(h*PI/
6、1;i++){a=a+days_of_month_2[i];}}else{for(i=0;i7、60+36000.770*t_century);}//求太阳的平黄径longdoubleG_sun(longdoublet_century){return(357.528+35999.050*t_century);}//求太阳的平近点角longdoubleecliptic_longitude(longdoubleL_sun,longdoubleG_sun){return(L_sun+1.915*sin(G_sun*PI/180)+0.02*sin(2*G_sun*PI/180));}//求黄道经度longdoubleearth_tilt(longdoublet_century){re8、turn(23.4393-0.0130*t_century);}//求地球倾角longdoublesun_deviation(longdoubleearth_tilt,longdoubleecliptic_longitude){return(180/PI*asin(sin(PI/180*earth_tilt)*sin(PI/180*ecliptic_longitude)));}//求太阳偏差longdoubleGHA(longdoubleUTo,longdoubleG_sun,longdoubleecliptic_longitude){return(UTo-180-1.915*sin9、(G_sun*PI/180)-0.02*sin(2*G_sun*PI/180)+2.466*sin(2*ecliptic_longitude*PI/180)-0.053*sin(4*ecliptic_longitude*PI/180));}//求格林威治时间的太阳时间角GHAlongdoublee(longdoubleh,longdoubleglat,longdoublesun_deviation){return180/PI*acos((sin(h*PI/
7、60+36000.770*t_century);}//求太阳的平黄径longdoubleG_sun(longdoublet_century){return(357.528+35999.050*t_century);}//求太阳的平近点角longdoubleecliptic_longitude(longdoubleL_sun,longdoubleG_sun){return(L_sun+1.915*sin(G_sun*PI/180)+0.02*sin(2*G_sun*PI/180));}//求黄道经度longdoubleearth_tilt(longdoublet_century){re
8、turn(23.4393-0.0130*t_century);}//求地球倾角longdoublesun_deviation(longdoubleearth_tilt,longdoubleecliptic_longitude){return(180/PI*asin(sin(PI/180*earth_tilt)*sin(PI/180*ecliptic_longitude)));}//求太阳偏差longdoubleGHA(longdoubleUTo,longdoubleG_sun,longdoubleecliptic_longitude){return(UTo-180-1.915*sin
9、(G_sun*PI/180)-0.02*sin(2*G_sun*PI/180)+2.466*sin(2*ecliptic_longitude*PI/180)-0.053*sin(4*ecliptic_longitude*PI/180));}//求格林威治时间的太阳时间角GHAlongdoublee(longdoubleh,longdoubleglat,longdoublesun_deviation){return180/PI*acos((sin(h*PI/
此文档下载收益归作者所有