#include stdio.h
为阳原等地区用户提供了全套网页设计制作服务,及阳原网站建设行业解决方案。主营业务为成都做网站、网站建设、阳原网站设计,以传统方式定制建设网站,并提供域名空间备案等一条龙服务,秉承以专业、用心的态度为用户提供真诚的服务。我们深信只要达到每一位用户的要求,就会得到认可,从而选择与我们长期合作。这样,我们也可以走得更远!
#include iostream.h
#include math.h
#includeiomanip.h
class Angle
{
public:
double degree,cent,second,Hudu,seconds;
//
构造函数
Angle(double _degree,double _cent,double _second)
{
degree=_degree;
cent=_cent;
second=_second;
seconds=(degree*3600+cent*60+second);
Hudu=(degree*3600+cent*60+second)*2*3.1415926535/(360*60*60);
}
Angle()
{
}
SToD()
{
second=seconds-int(seconds/60)*60;
degree=int((seconds-second)/3600);
cent=int((seconds-second-degree*3600)/60);
}
~Angle()
{
}
};
void main()
{
//
正算过程
//
定义变量
Angle B(51,38,43.9023),L(126,2,13.1360),_B,_L;
double L0,l,N,a0,a4,a6,a3,a5,x,y,rou;
rou=(360*60*60)/(2*3.1415926535);
if(int(L.degree)%6!=0)
{
L0=6*(int(L.degree)/6+1)-3+6;
}
else
L0=6*(int(L.degree)/6)-3+6;
l=L.Hudu-L0*3600*2*3.1415926535/(360*60*60);
N=6399698.902-(21562.267-(108.973-0.612*cos(B.Hudu)*cos(B.Hudu))*cos(B.Hudu)*cos(
B.Hudu))*cos(B.Hudu)*cos(B.Hudu);
a0=32140.404-(135.3302-(0.7092-0.0040*cos(B.Hudu)*cos(B.Hudu))*cos(B.Hudu)*cos(B.
Hudu))*cos(B.Hudu)*cos(B.Hudu);
a4=(0.25+0.00252*cos(B.Hudu)*cos(B.Hudu))*cos(B.Hudu)*cos(B.Hudu)-0.04166;
a6=(0.166*cos(B.Hudu)*cos(B.Hudu)-0.084)*cos(B.Hudu)*cos(B.Hudu);
a3=(0.3333333+0.001123*cos(B.Hudu)*cos(B.Hudu))*cos(B.Hudu)*cos(B.Hudu)-0.166666
7;
a5=0.0083-(0.1667-(0.1968+0.0040*cos(B.Hudu)*cos(B.Hudu))*cos(B.Hudu)*cos(B.Hudu)
)*cos(B.Hudu)*cos(B.Hudu);
x=6367558.4969*B.Hudu-(a0-(0.5+(a4+a6*l*l)*l*l)*l*l*N)*sin(B.Hudu)*cos(B.Hudu);
y=(1+(a3+a5*l*l)*l*l)*l*N*cos(B.Hudu);
//结果输出
cout"x="xendl;
cout"y="yendl;
// 反算过程
double b,Bf,Nf,Z,b2,b3,b4,b5,l1;
b=(x/6367558.4969);
Bf=b+(50221746+(293622+(2350+22*cos(b)*cos(b))*cos(b)*cos(b))*cos(b)*cos(b))*0.000
0000001*sin(b)*cos(b);
Nf=6399698.902-(21562.267-(108.973-0.612*cos(Bf)*cos(Bf))*cos(Bf)*cos(Bf))*cos(Bf)*c
os(Bf);
Z=y/(Nf*cos(Bf));
b2=(0.5+0.003369*cos(Bf)*cos(Bf))*sin(Bf)*cos(Bf);
b3=0.333333-(0.166667-0.001123*cos(Bf)*cos(Bf))*cos(Bf)*cos(Bf);
b4=0.25+(0.16161+0.00562*cos(Bf)*cos(Bf))*cos(Bf)*cos(Bf);
b5=0.2-(0.1667-0.0088*cos(Bf)*cos(Bf))*cos(Bf)*cos(Bf);
_B.seconds=Bf*rou-(1-(b4-0.12*Z*Z)*Z*Z)*Z*Z*b2*rou;
l1=(1-(b3-b5*Z*Z)*Z*Z)*Z*rou;
_L.seconds=L0*3600+l1;
_B.SToD();
_L.SToD();
#include stdio.h
double f(double x)
{return(x*3+1);}
void main(){
double x;
scanf("%lf",x);
printf("%lf",f(x));
}
#includestdio.h
#includeconio.h
void login();
void add();
bool flags = true;
void main()
{
while(flags)
login();
//add();
//getch();
}
void login()
{
int k;
int L=888;
printf("口令888;请输入验证口令:");
scanf("%d",k);
if(L==k)
{
int choice;
printf("您输入正确,欢迎使用C计算器\n");
printf("+=======选择要做的运算=======+\n");
printf("+= 1、加法 =+\n");
printf("+= 2、减法 =+\n");
printf("+= 3、乘法 =+\n");
printf("+= 4、除法 =+\n");
printf("+= 5、求余 =+\n");
printf("+= 0、退出 =+\n ");
printf("+============================+\n");
scanf("%d",choice);
switch(choice)
{
case 1:
add();
break;
case 0:
flags = false;
break;
default : printf("您输入有误");
break;
}
}
else
{
printf("您输入错误,请重新输入!");
}
}
void add()
{
int jia,fa;
printf("请输入2个数");
scanf("%d %d",jia,fa);
printf("%d+%d=%d\n",jia,fa,jia+fa);
}
首先你add写在login里面,main先执行login在执行add,可是add在login了,所以main保留一个login,函数不能嵌套,add写在外面。为了实现循环,添加一个标志位flags初始为true,在选项里添加一个退出,选择之后flags设为flase,退出计算器。