C++相談室 part89
■ このスレッドは過去ログ倉庫に格納されています
0700デフォルトの名無しさん
2011/07/02(土) 16:30:59.09#include<iostream>
using namespace std;
class cord{
public:
int x,y;
cord operator+(cord o);
cord(int i=0,int x=0){x=i,y=x;} };
cord cord::operator+(cord o) {
cord tem;
tem.x=x+o.x; tem.y=y+o.y;
o.x=0; return tem; }
int main(){
cord w(1,1),r(9,1),o;
o=w+r;
cout<<o.x<<','<<o.y<<"ここまでテキスト\n";
cout<<r.x;
char p;
while(p=getchar()!='o');
return 0; }
コンパイルは通るんですが計算の実行結果が意味不明なので原因を教えてください
<<実行結果>>
-1717986920,10ここまでテキスト
-858993460
■ このスレッドは過去ログ倉庫に格納されています