24小时热门版块排行榜    

北京石油化工学院2026年研究生招生接收调剂公告
查看: 725  |  回复: 6
当前主题已经存档。
当前只显示满足指定条件的回帖,点击这里查看本话题的所有回帖

zhanglei22

银虫 (小有名气)

[交流] 【求助】好心人帮我看看这个c++! 谢谢了

这个程序在vc++ 6.0 怎么运行不了啊 ? 求助!问题在哪里这么改啊 ?谢谢了
#include
#include

struct polar
{
        double distance;
        double angle;
};

struct rect
{
        double x;
        double y;
};

polar rect_to_polar(rect xypos);
void show_polar(polar dapos);

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<<"Done.\n";
        return 0;
}

polar rect_to_polar(rent 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(pelar dapos)
{
        const double Rad_to_deg=57.29577951;

        cout<<"distance="<< dapos.distance;
        cout<<", angle="<         cout<<" degrees\n";
}

[ Last edited by nono2009 on 2009-9-30 at 00:00 ]
回复此楼

» 猜你喜欢

已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

hxz

木虫 (正式写手)


小木虫(金币+0.5):给个红包,谢谢回帖交流
没写拷贝复制函数 结构赋值不能用=
lz的纯c风格 囧
4楼2009-09-23 16:51:37
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖
查看全部 7 个回答

yeyunxiao

铁杆木虫 (小有名气)

★ ★ ★ ★
小木虫(金币+0.5):给个红包,谢谢回帖交流
wangen994(金币+3,VIP+0):辛苦了,谢谢你对程序软件版的支持 9-23 12:13
#include
#include

struct polar
{
        double distance;
        double angle;
};

struct rect
{
        double x;
        double y;
};

polar rect_to_polar(rect xypos);
void show_polar(polar dapos);

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<<"Done.\n";
        return 0;
}

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="<         cout<<" degrees\n";
}

嘿嘿,是编译错误吧,

是你的笔误啊,帮你用红色标出来了

编程的时候一定要细心哦!
2楼2009-09-23 10:36:16
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

zhanglei22

银虫 (小有名气)

谢谢

我是论坛新人 且 新手学vc!

  感谢好心人帮忙!

  我在看 c++ primer plus 这本书, 用vc++ 6.0运行, 他里面得 这个语句
    using namespace std:   必须删了 才能在vc++ 6.0 运行。我有点一知半解。

  
  还有我有c得 基础 ,前面的基础 一扫而过,重点想看后面 对象啊  类什么的,
这种方法可行吧?
3楼2009-09-23 16:45:22
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

hxz

木虫 (正式写手)

引用回帖:
Originally posted by zhanglei22 at 2009-9-23 16:45:
我是论坛新人 且 新手学vc!

  感谢好心人帮忙!

  我在看 c++ primer plus 这本书, 用vc++ 6.0运行, 他里面得 这个语句
    using namespace std:   必须删了 才能在vc++ 6.0 运行。我有点一知半解。

...

因为c++ primer plus用的是iso c++标准, vc6不完全兼容
学c++最好不要用vc6
5楼2009-09-23 16:53:38
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖
普通表情 高级回复 (可上传附件)
最具人气热帖推荐 [查看全部] 作者 回/看 最后发表
[考研] 一志愿武汉理工,总分321,英一数二,求老师收留。 +7 nnnnnnn5 2026-03-25 7/350 2026-03-29 00:32 by 我是小康
[考研] 2026年华南师范大学欢迎化学,化工,生物,生医工等专业优秀学子加入! +3 llss0711 2026-03-28 5/250 2026-03-29 00:23 by MRMFYTL
[考研] 317分 一志愿南理工材料工程 本科湖工大 求调剂 +7 芋泥小铃铛 2026-03-28 7/350 2026-03-28 21:38 by 小木虫tim
[考研] 332求调剂 +4 @MZB382400 2026-03-28 4/200 2026-03-28 21:02 by 唐沐儿
[考研] 085602 307分 求调剂 +7 不知道叫什么! 2026-03-26 7/350 2026-03-28 09:57 by 神马都不懂
[考研] 材料求调剂 一志愿哈工大总分298分,前三科223分 +5 dongfang59 2026-03-27 5/250 2026-03-28 04:53 by wxiongid
[考研] 266分求材料化工冶金矿业等专业的调剂 +4 哇呼哼呼哼 2026-03-26 4/200 2026-03-27 17:02 by zhyzzh
[考博] 26申博 +3 加油冲啊! 2026-03-26 3/150 2026-03-27 15:38 by cls512
[考研] 283求调剂(080500) +4 A child 2026-03-27 4/200 2026-03-27 15:34 by XPU李庆
[考研] 安徽大学专硕生物与医药专业(086000)324分,英语已过四六级,六级521,求调剂 +4 美味可乐鸡翅 2026-03-26 4/200 2026-03-27 15:27 by 星空星月
[考研] 324求调剂 +5 hanamiko 2026-03-26 5/250 2026-03-27 10:33 by wangjy2002
[考研] 349求调剂 +4 李木子啊哈哈 2026-03-25 4/200 2026-03-26 22:49 by fmesaito
[考研] 340求调剂 +3 Amber00 2026-03-26 3/150 2026-03-26 18:57 by 不吃魚的貓
[考研] 材料与化工304求B区调剂 +3 邱gl 2026-03-26 6/300 2026-03-26 18:03 by 邱gl
[考研] 打过很多竞赛,085406控制工程300分,求调剂 +3 askeladz 2026-03-26 3/150 2026-03-26 09:08 by 给你你注意休息
[考研] 26考研-291分-厦门大学(085601)-柔性电子学院材料工程专业求调剂 +3 min3 2026-03-24 4/200 2026-03-25 18:22 by xcjcqu
[考研] 0854AI CV方向招收调剂 +4 章小鱼567 2026-03-23 4/200 2026-03-25 17:04 by CoderLoser
[考研] 求调剂 +3 李李不服输 2026-03-25 3/150 2026-03-25 13:03 by cmz0325
[考研] 284求调剂 +3 yanzhixue111 2026-03-23 6/300 2026-03-23 22:58 by pswait
[考研] 接收2026硕士调剂(学硕+专硕) +4 allen-yin 2026-03-23 6/300 2026-03-23 15:04 by 汪!?!
信息提示
请填处理意见