DEV-C++如何同时编译多个文件
DEV-C++可以建一个工程同时编译多个文件,如何操作?谢谢大虾知道!文件一:
#ifndef COORDIN_H_
#define COORDIN_H_
struct polar
{
double distance; //distance from origin
double angle; //direction from origin
};
struct rect
{
double x; //horizontal distance from origin
double y; //vertical distance from origin
};
//prototypes
polar rect_to_polar(rect xypos);
void show_polar(polar dapos);
#endif
文件二:
#include <iostream>
#include "coordin.h" //stucture templates,function prototypes
using namespace std;
int main()
{
rect rplace;
polar pplace;
cout<<"Enter the x and y values: ";
while(cin>>rplace.x>>rplace.y) //slick use of cin
{
rect_to_polar(&rplace,&pplace);
show_polar(&pplace);
cout<<"Next two numbers(q to quit): ";
}
cout<<"Done.\n";
system("PAUSE");
return 0;
}
文件三:
#include <iostream>
#include <cmath>
#include "coordin.h" //structure templates,function prototypes
//convert rectangular to polar coordinates
polar rect_to_polar(rect xypos)
{
using namespace std;
polar answer;
answer.distance=
sqrt(xypos.x*xypos.x+xypos.y*xypos.y);
answer.angle=atan2(xypos.y,xypos.x);
return answer; //returns a polar structure
}
//show polar coordinates,conerting angle to degrees
void show_polar(polar dapos)
{
using namespace std;
const double Rad_to_deg=57.29277951;
cout<<"distance = "<<pda.distance;
cout<<", angle = "<<pda.angle *Rad_to_deg;
cout<<" degress\n";
}