




版權(quán)說(shuō)明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
1、#include#include#include#include#define MAX 100#define PI 3.1415926/結(jié)構(gòu)體存放 B, L, Hstruct BLH(char namel20;char name220;double B;char name320;double L;char name420;double H;lllllllllllllllllllllllllllllll結(jié)構(gòu)體存放 X,Y,Zstruct XYZ (char namel20; char name220; double X;char name320;double Y;char name420;dou
2、ble Z;lllllllllllllllllllllllllllllllll文件輸入 B,L,Hdouble FILEIN(BLH &b,char *fname) (ifstream in(fname,ios:nocreate); /建立文件流,并與輸入文件名建立關(guān)聯(lián) if(!in) coutfname error: file does not exist! endl;cout請(qǐng)手動(dòng)輸入數(shù)據(jù) nMendl;return 0;l;2;inb.B;3;inb.L;4;inb.H;in.close();return 1;lllllll
3、lllllllllllllllllllllllllllllllllllllllll文件輸入 X,YZdouble FILEIN1(XYZ &b,char *fname) (ifstream in(fname,ios:nocreate); /建立文件流,并與輸入文件名建立關(guān)聯(lián) if(!in) coutfname error: file does not exist! endl;cout請(qǐng)手動(dòng)輸入數(shù)據(jù)nHendl;return 0;l;2;inb.X;3;inb.Y;4;inb.Z;in.close();return 1;llllll
4、lllllllllllllllllllllllllllllllllllllllllllllllllldouble d_h(double angle)角度化弧度(double a,b;angle=modf(angle,&a);angle=modf(angle*100.0,&b);return (a+b/60.0+angle/36.0)*(PI+3.0E-16)/180.0;llllllllllllllllllllllllllllllllllllllllllllllllllllllllllldouble h_d(double angle)弧度化角度(double a,b,c;angle=modf(
5、angle*180.0/(PI-3.0E-16),&a);angle=modf(angle*60.0,&b);angle=modf(angle*60.0,&c);return a+b*0.01+c*0.0001+angle*0.0001;lllllllllllllllllllllllllllllllllllllllllll鍵盤(pán)輸入 B,L,Hjianpan(BLH &a)(cout請(qǐng)輸入大地坐標(biāo)B endl;cina.B;coutiW輸入大地坐標(biāo)L Hendl;cina.L;coutiW輸入大地坐標(biāo)H endl;cina.H;jianpanl(XYZ &a)(coutn請(qǐng)輸入空間直角坐標(biāo)X e
6、ndl;cina.X;coutn請(qǐng)輸入空間直角坐標(biāo)Y endl;cina.Y;coutn請(qǐng)輸入空間直角坐標(biāo)Z endl;cina.Z;llllllllllllllllllllllllllllllllllllllllllllllllllllll 標(biāo)系double B_X(BLH &a)(double aaMAXMAX;double al,bl,N,El,X,YZ;int kznzm;char outfilename20/fname20;cout請(qǐng)選擇:endl;coutHl:文件輸入endl;cout,2:鍵盤(pán)輸入endl;cinm;if(m=l)(coutniW 輸入文件名 Hendl;cin
7、fname;if(FILEIN(a,fname);else(if(jianpan(a);else鍵盤(pán)輸入xxz大地坐標(biāo)系換算到空間直角坐選擇數(shù)據(jù)輸入方式cout”輸入有誤,程序中止,請(qǐng)重新運(yùn)行Hendl;return false;else if(m=2)jianpan(a);elsecout “輸入代碼有誤,程序中止,請(qǐng)重新運(yùn)行” endl;return false;if(a.B90)cout“輸入B有誤,程序中止,請(qǐng)重新運(yùn)行Hendl;克拉索夫斯基橢球體Hendl;1975年國(guó)際橢球體endl;WGS-84 橢球體endl;2000中國(guó)大地坐標(biāo)系Mendl;選擇橢球體return false
8、;if(a.L360)cout“輸入L有誤,程序中止, return false;if(a.H0)cout“輸入H有誤,程序中止, return false;aa 0 0=6378245.0000000000;aal0=6378140.0000000000;aa20=6378137.0000000000;aa30=6378137.000;cout請(qǐng)選擇橢球體endl;coutH0:coutl:coutn2:coutH3:cink;請(qǐng)重新運(yùn)行” endl;請(qǐng)重新運(yùn)行Hendl;aa0l=6356863.0187730473;aall=6356755.2881575287;aa2l=6356752
9、.3142;aa3l=6356752.314;屏幕輸出結(jié)文件輸出結(jié)if(k!=0&k!=l&k!=2&k!=3)cout“輸入代碼有誤,程序中止,請(qǐng)重新運(yùn)行”endl;return false;couta.Bendl;al=aak0;bl=aakl;El=(al*al-bl*bl)/(al*al);a.B=d_h(a.B);a.L=d_h(a.L);N=al/sqrt(l-El*sin(a.B)*sin(a.B);X=(N+a.H)*cos(a.B)*cos(a.L);Y=(N+a.H)*cos(a.B)*sin(a.L);Z=(N*(l-El)+a.H)*sin(a.B);coutH轉(zhuǎn)換后的
10、空間直角坐標(biāo)是:” endl;果coutHX nXendl;coutY Yendl;coutHZ nZendl;cout要保存數(shù)據(jù)嗎? endl;coutl:保存endl;coutH2 不保存endl;cinn;if(n=l)(coutn請(qǐng)輸入保存的文件名endl;果cinoutfilename;ofstream out(outfilename); out.precision(lO);if(!out) coutHcan not open save file!Nendl; outH空間直角坐標(biāo)endl; outX,endl; outXendl; out,Y,endl; outYendl; out
11、Z,endl; outZendl; out.close(); else if(n=2); else(cout輸入代碼有誤,程序中止,請(qǐng)重新運(yùn)行endl; return false; cout 謝謝您使用龔曉鵬編的程序,所有任務(wù)均巳完成,歡迎下次使用,祝生活愉快 endl;IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII空間直角坐標(biāo)系換算到大地坐標(biāo)系 double X_B(XYZ &a) double al,bl,N,E1,B,L,H,BO,aaMAXMAX; double tanBMAXl; int i=0,n,k,m;cha
12、r outfilename20zfname20;選擇數(shù)據(jù)輸入方式 coutiW選擇:endl; coutHl:文件輸入endl; cout2:鍵盤(pán)輸入endl; cinm; if(m=l) (coutniW 輸入文件名 Hendl; cinfname; if(FILEINl(a,fname); else (if(jianpanl(a); else(cout輸入有誤,程序中止,請(qǐng)重新運(yùn)行endl; return false; else if(m=2)jianpanl(a);elsecout“輸入代碼有誤,程序中止,請(qǐng)重新運(yùn)行Hendl; return false;aa 0 0=6378245.0
13、000000000;aal0=6378140.0000000000;aa20=6378137.0000000000;aa30=6378137.000;aa0l=6356863.0187730473;aall=6356755.2881575287;aa2l=6356752.3142;aa3l=6356752.314;cout0.000000000000001);coutiendl;N=al/sqrt(l-El*sin(B)*sin(B);H=sqrt(a.X*a.X+a.Y*a.Y)/cos(B)-N;B=h_d(B);L=h_d(L);if(a.X0&a.Y0)L=180+L;else if(
14、a.X0)L=180+L;else if(a.X0&a.Y0)L=360+L;cout“轉(zhuǎn)換后的大地坐標(biāo)是:Nendl;屏幕輸 出結(jié)果coutHB Bendl;coutHL Lendl; coutH NHendl;cout要保存數(shù)據(jù)嗎? endl;coutl:保存endl;cout2 不保存Mendl;cinn;if(n=l)cout“請(qǐng)輸入保存的文件名”endl;將結(jié)果保存到文件cinoutfilename;ofstream out(outfilename);out.precision(15);if(!out) coutMcan not open save file!Nendl;outH空間直角坐標(biāo)endl;out,B,endl;outBendl;outL,endl;outLendl;outH,endl;outHendl;out.close();else if(n=2);else(cout輸入代碼有誤,程序中止,請(qǐng)重新運(yùn)行,endl;return fa
溫馨提示
- 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 篷布行業(yè)人才培養(yǎng)規(guī)劃考核試卷
- 海洋油氣開(kāi)采海域使用權(quán)管理考核試卷
- 礦山開(kāi)采對(duì)生物多樣性影響考核試卷
- 起點(diǎn)初三語(yǔ)文作文
- 液壓系統(tǒng)在金屬加工中的應(yīng)用考核試卷
- 球類(lèi)制造技術(shù)與材料創(chuàng)新考核試卷
- 禮儀用品行業(yè)發(fā)展趨勢(shì)預(yù)測(cè)考核試卷
- 蘭州資源環(huán)境職業(yè)技術(shù)大學(xué)《藥物合成原理》2023-2024學(xué)年第二學(xué)期期末試卷
- 江蘇省大豐市劉莊鎮(zhèn)三圩初級(jí)中學(xué)2024-2025學(xué)年初三下學(xué)期5月學(xué)情調(diào)研考試化學(xué)試題試卷含解析
- 遼寧商貿(mào)職業(yè)學(xué)院《程序可信分析與構(gòu)造》2023-2024學(xué)年第二學(xué)期期末試卷
- 2024年財(cái)務(wù)會(huì)計(jì)制度模版(4篇)
- 2025年河北省職業(yè)院校技能大賽建筑工程識(shí)圖(高職組)賽項(xiàng)參考試題庫(kù)(含答案)
- 辦公用品、易耗品供貨服務(wù)方案
- 專(zhuān)升本英語(yǔ)連詞
- 2024心理健康服務(wù)規(guī)范
- 《高績(jī)效團(tuán)隊(duì)》課件
- 2024年廣東省汕頭市龍湖區(qū)中考語(yǔ)文一模試卷
- 中輻放射性藥物貯存及銷(xiāo)售項(xiàng)目環(huán)評(píng)資料環(huán)境影響
- (人教2024版)數(shù)學(xué)五年級(jí)上冊(cè)第6單元《多邊形的面積》大單元教學(xué)課件
- 行政事業(yè)單位內(nèi)部控制制度之合同管理制度
- 大學(xué)生心理健康與發(fā)展學(xué)習(xí)通超星期末考試答案章節(jié)答案2024年
評(píng)論
0/150
提交評(píng)論