- 论坛徽章:
- 0
|
coordin.h
--------------------------------------
#ifndef COORDIN_H_
#define COORDIN_H_
struct polar{
double distance;
double angle;
};
struct rect{
double x;
double y;
};
polar rect_to_polar(rect xypos);
void show_polar(polar dapos);
#endif
-------------------------------------------------
file1.cpp
-------------------------------------------------
#include <iostream>;
#include "coordin.h"
int main(){
rect rplace;
polar pplace;
cout<<"Enter the x and y values:";
while(cin>;>;rplace.x>;>;rplace.y){
pplace=rect_to_polar(rplace);
show_polar(pplace);
cout<<"Next two numbers (q to quit):";
}
cout<<"Bye!\n";
return 0;
}
-------------------------------------------------
file2.cpp
-------------------------------------------------
#include <iostream>;
#include <cmath>;
#include "coordin.h"
using namespace std;
polar rect_to_polar(rect xypos){
polar answer;
answer.distance=sqrt(xypos.x*xypos.x+xypos.y*xypos.y);
answer.angle=atan2(xypos.y,xypos.x);
return answer;
}
void show_polar(polar dapos){
const double Rad_to_deg=57.29577951;
cout<<"distance="<<dapos.distance;
cout<<",angle="<<dapos.angle*Rad_to_deg;
cout<<"degrees\n";
}
//调试出错,是不是vc++6.0 不支持,我是新手,还请高手指教!!
--------------------Configuration: file1 - Win32 Debug--------------------
Compiling...
file1.cpp
c:\program files\microsoft visual studio\vc98\include\iostream(16) : fatal error C1001: INTERNAL COMPILER ERROR
(compiler file 'msc1.cpp', line 1786)
Please choose the Technical Support command on the Visual C++
Help menu, or open the Technical Support help file for more information
Error executing cl.exe.
file1.obj - 1 error(s), 0 warning(s) |
|