喵宅苑 MewoGarden × 技术宅社区II | Z站 Z Station 棒棒哒纯文字二次元技术社区

正文

为什么用不同的软件输出结果会不同?

作者:樱花流逝
总之问题是这样的[mw_shl_code=applescript,true]#include<iostream> using namespace std; class point{ private: int x, y; public: point(int a = 0, int b = 0){ x = a; y = b; } point(point &p); int getx(){ return x; } int gety(){ return y; } }; point::point(point &p){ x = p.x + 10;[mw_shl_code=applescript,true]point::point(point &p){ x = p.x + 10; y = p.y + 20; cout << "调用拷贝构造函数" << endl; } y = p.y + 20; cout << "调用拷贝构造函数" << endl; } void f(point &p){ cout << p.getx() << " " << p.gety() << endl; } point g(){ point q(3, 5); return q; } int main() { point p1(2, 4); point p2(p1); cout << p2.getx() << " " << p2.gety() << endl; f(p2); p2 = g(); cout << p2.getx() << " " << p2.gety() << endl; system("pause"); return 0; } [/mw_shl_code] 用cb编译运行的得到的结果是这样的[attach]428336[/attach] 而用vs2013编译得到的结果是这样的[attach]428337[/attach] 虽然乱码也是问题。。。 但主要是为什么使用vs2013时在执行[mw_shl_code=applescript,true]p2 = g();[/mw_shl_code]时调用了 [mw_shl_code=applescript,true]point::point(point &p){ x = p.x + 10; y = p.y + 20; cout << "调用拷贝构造函数" << endl; }[/mw_shl_code] 而cb没有这一步?

回复

作者:樱花流逝
为什么开头的那个只有一半变成了代码的格式@@26!!
查看回复
上一页
下一页
0%
站点地图友情链接:
喵宅苑
喵空间社区程序
喵宅苑 静态版
宅喵RPG地图编辑器
络合兔
Lanzainc
技术宅
小五四博客
莉可POI
Mithril.js
枫の主题社
Project1
午后少年
机智库
七濑胡桃
xiuno
幻想の日常
魂研社
Nothentai
0xffff
欲望之花
泽泽社长
淀粉月刊
HAYOU
红客联盟
异次元
轻之国度
神奇宝贝新生代
游戏狗
口袋双子星
我的世界论坛
梦次元
动漫东东
动漫国际
精艺论坛
78动漫
吐槽弹幕网
漫客栈