求帮助,编译能通过,但运行却是一行乱码,
#include "stdafx.h"#include<iostream>
#include<math.h>
using namespace std;
float zh(float &a,float &b){
while(a>=-180&&a<=180&&b>=0&&b<=90){
float x,y,z;
if(a>=0)
x=cos(abs(a-90))*(1-abs(b)/90);
if(a<0)
x=-cos(abs(a-90))*(1-abs(b)/90);
return x;
if(a>=-90&&a<=90)
y=-sin(abs(a-90))*abs(a-90)/90;
if(a<-90&&a>90)
y=sin(abs(a-90))*abs(a-90)/90;
return y;
if(b>=0)
z=-cos(abs(a-90));
if(b<0)
z=cos(abs(a-90));
return z;
}
}
int main(int argc, char* argv[])
{
float x1,y1,x2,y2;
float x,y,z;
cout<<"请输入一个位置的经纬度:"<<endl;
cin>>x1>>y1;
cout<<"请输入另一个位置的经纬度:"<<endl;
cin>>x2>>y2;
zh(x1,y1);
cout<<"x1:"<<x<<"y1:"<<y<<"z1:"<<z<<endl;
zh(x2,y2);
cout<<"x2:"<<x<<"y2:"<<y<<"z2:"<<z<<endl;
return 0;
}