发布时间:2013-01-01 20:50:23
#include "stdafx.h" #define swap1(a,b) {int c;c=a;a=b;b=c;}#define swap2(a,b) {a^=b,b^=a;a^=b;} int _tmain(int argc, _TCHAR* argv[]){ int a1=3; int b1=5; swap1(a1,b1); printf("a = %d, b= %d \n",a1,b1); int a2=3; int b2=5; swap2(a2,b2); &n......【阅读全文】
发布时间:2012-12-31 16:59:07
// operatorReload.cpp : 定义控制台应用程序的入口点。// #include "stdafx.h" class CPoint {public: CPoint(int x1,int y1); CPoint operator+(CPoint pt); CPoint operator-(CPoint pt); void operator=(CPoint pt); void PrintPt(); private: int x; int y;}; CPoint::CPoint(int x1,int y1)......【阅读全文】
发布时间:2012-12-31 15:41:18
#include "stdafx.h"#include <iostream>using namespace std; class cat{public: cat(); cat(cat*); void setInfo(int age,int color,int weight); void printInfo();private: int age; int weight; int color;}; cat::cat(){} cat::cat(cat* a_cat){ this->age = a_......【阅读全文】
发布时间:2012-12-31 11:11:45
#include "stdafx.h"#include <iostream>using namespace std; class animal{public: virtual void eat() = 0;}; class bird : public animal{public: virtual void eat();}; class beast: public animal{public: virtual void eat();}; class cock:public bird{public: virtual void eat();......【阅读全文】
发布时间:2012-12-28 14:07:19
#include "stdafx.h"#include <iostream> class cat{public: friend void setCatHigh(cat* wendy,int value); friend void setCatWeight(cat* wendy,int value); friend void setCatColor(cat* wendy,int value); public: void getCatInfo(int &high,int &weight,int &color);priv......【阅读全文】