#include<iostream>#include<cmath>#include<iomanip>using namespace std;
class shape{public:virtual double area()const{return 0.0;}virtual double zhouchang()const{return 0.0;}};
class sanjiaoxing :public shape{double a,b,c;public:sanjiaoxing(double x,double y,double z){a=x;b=y,c=z;}
virtual doub...
看拷贝构造函数的时候 看到对象本体 对象实体 是什么意思啊
看了半天 还是模模糊糊 呵呵
#include<iostream>#include<string>#include<iomanip>using namespace std;class person{string pname;//char*pname;public: person(char* pn="noname") {cout<<"constructing "<<pn<<endl; //pname=new char[strlen(pn)+1]; //if( pname) strcpy(pname,pn); pname=pn; } person(const person &s) {cout<<"c...
我想考研 想考计算机方面的 虽然难度很大 自己不太聪明 但我会努力的
那我考研之前 应准备点什么呢 具体的说下注意事项呗
谢谢 哥哥姐姐 弟弟妹妹 们
#include<iostream>#include<iomanip>#include<stdio.h>using namespace std;class vehicle{protected: int carl; double carw;
};class truck:private vehicle{double zks; double zkw;public: truck(int x,double y,int m,double n); void truckshow();
};truck::truck(int x,double y,int m,double n){carl=x;ca...
我不上啦 最讨厌别人催我啦 催死啦
#include<iostream>using namespace std;void delay(int a=2){int sum=0; for(int i=1;i<=a;++i) for(int j=1;j<3500;++j) for(int k=1;k<100000;++k) sum++;
}void main(){cout<<"delay40 seconds "; delay(40);
}
delay函数中的程序是么意思啊;象这样的函数什么时候括号里有形参。
返回类型不同不能重载
为什么
double abs(double);
{return (a>0)?a:-...
#include<iostream>#include<iomanip>#include<string>#include<stdio.h>using namespace std;class person{private: string _name;public: void printname(); void setname(string name){_name=name;}};
void person::printname (){cout<<_name<<endl;}
class student:public person{private:long _number;p...
#include<iostream>using namespace std;class actor{private: string _name; bool _gender;public: void setname(string name,bool gender); void say();};
void actor::setname (string name,bool gender){_name=name; _gender=gender;}
void actor::say (){cout<<_name<<": 我乃"<<_name<<"是也"<<endl;}
...
#include<iostream>#include<iomanip>using namespace std;class account{private: string _name; long _balance;public: void credit(long amount); void debit(long amount); void setname(string name); getbalance();};
void account::setname (string name){_name=name; _balance=0; }
void account::credi...
定义一个点类 计算两点之间的距离 是2维的
如果我问白痴的问题 希望大家不要介意
#include<iostream>#include<stdio.h>#include<math.h>
using namespace std;class point{int x,y;public: void set(int a,int b){x=a;y=b;} void distance(point a,point b);};void point::distance(point a,point b) {point a; point b; double s; s=sqr((a.x -b.x )*(...