| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1309 人关注过本帖
标题:DEV-C++如何同时编译多个文件
只看楼主 加入收藏
tymstill
Rank: 1
等 级:新手上路
帖 子:31
专家分:0
注 册:2008-1-28
结帖率:100%
收藏
 问题点数:0 回复次数:2 
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";
     }
搜索更多相关主题的帖子: origin distance 文件 polar double 
2008-03-20 15:29
Waiting159
Rank: 1
等 级:新手上路
帖 子:24
专家分:0
注 册:2007-11-7
收藏
得分:0 
新建 -> 工程 -> Console Application -> ……
2008-03-20 20:43
tymstill
Rank: 1
等 级:新手上路
帖 子:31
专家分:0
注 册:2008-1-28
收藏
得分:0 
能不能具体点啊
2008-03-21 09:03
快速回复:DEV-C++如何同时编译多个文件
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.020275 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved