#include <iostream.h>
class planet{
protected:
double distance; //miles from the sun
int revolve; //in days
public:
planet(double d,int r)
{distance=d;
revolve=r;
}
};
class earth:public planet{
double circumference; //circumference of orbit
public:
/* Creater earth(double d,int r).Have it pass the distance and days of
revolution back to planet.Have it compute the circumference of the
orbit.(Hint:circumference=2*r*3.1416)*/
/* Create a funciton called show() that displays ther information. */
};
main()
{
earth ob(930000000,365);
ob.show();
return 0;
}
8 个解决方案
#1
帮你顶!!!!!!!!!!!!!!!!!!!!!
#2
555555555
#3
一时想不出来,想帮你顶。里面要用到物理知识来进行解题...
#4
谢谢各位了。
很急。
今天晚上要交作业了。
在线等
很急。
今天晚上要交作业了。
在线等
#5
up ing
物理……
物理……
#6
#include <iostream.h>
class planet{
protected:
double distance; //miles from the sun
int revolve; //in days
public:
planet(double d,int r)
{distance=d;
revolve=r;
}
};
class earth:public planet{
double circumference; //circumference of orbit
public:
earth(double d,int r):planet(d,r)
{
}
void CaluCircumference();
//(Hint:circumference=2*r*3.1416)*/
void Show();// that displays ther information. */
};
void earth::CaluCircumference()
{
circumference=2*revolve*3.1416;
}
void earth::Show()
{
cout<<"distance="<<distance<<endl;
cout<<"revolue="<<revolve<<endl;
cout<<"Circumferencr="<<circumference;
}
int main()
{
earth ob(930000000,365);
ob.CaluCircumference();
ob.Show();
return 0;
}
class planet{
protected:
double distance; //miles from the sun
int revolve; //in days
public:
planet(double d,int r)
{distance=d;
revolve=r;
}
};
class earth:public planet{
double circumference; //circumference of orbit
public:
earth(double d,int r):planet(d,r)
{
}
void CaluCircumference();
//(Hint:circumference=2*r*3.1416)*/
void Show();// that displays ther information. */
};
void earth::CaluCircumference()
{
circumference=2*revolve*3.1416;
}
void earth::Show()
{
cout<<"distance="<<distance<<endl;
cout<<"revolue="<<revolve<<endl;
cout<<"Circumferencr="<<circumference;
}
int main()
{
earth ob(930000000,365);
ob.CaluCircumference();
ob.Show();
return 0;
}
#7
#include <iostream.h>
class planet{
protected:
double distance; //日地距离
int revolve; //公转周期
public:
planet(double d,int r)
{distance=d;
revolve=r;
}
};
class earth:public planet{
double circumference; //公转轨道周长
public:
earth(double d,int r):planet(d,r){
circumference=2*3.1416*r;
}
show(){
cout<<"日地距离:"<<distance<<"公转轨道周长:"<<circumference<<endl;
}
};
main()
{
earth ob(930000000,365);
ob.show();
return 0;
}
class planet{
protected:
double distance; //日地距离
int revolve; //公转周期
public:
planet(double d,int r)
{distance=d;
revolve=r;
}
};
class earth:public planet{
double circumference; //公转轨道周长
public:
earth(double d,int r):planet(d,r){
circumference=2*3.1416*r;
}
show(){
cout<<"日地距离:"<<distance<<"公转轨道周长:"<<circumference<<endl;
}
};
main()
{
earth ob(930000000,365);
ob.show();
return 0;
}
#8
地5行的注释应该是地球半径
#1
帮你顶!!!!!!!!!!!!!!!!!!!!!
#2
555555555
#3
一时想不出来,想帮你顶。里面要用到物理知识来进行解题...
#4
谢谢各位了。
很急。
今天晚上要交作业了。
在线等
很急。
今天晚上要交作业了。
在线等
#5
up ing
物理……
物理……
#6
#include <iostream.h>
class planet{
protected:
double distance; //miles from the sun
int revolve; //in days
public:
planet(double d,int r)
{distance=d;
revolve=r;
}
};
class earth:public planet{
double circumference; //circumference of orbit
public:
earth(double d,int r):planet(d,r)
{
}
void CaluCircumference();
//(Hint:circumference=2*r*3.1416)*/
void Show();// that displays ther information. */
};
void earth::CaluCircumference()
{
circumference=2*revolve*3.1416;
}
void earth::Show()
{
cout<<"distance="<<distance<<endl;
cout<<"revolue="<<revolve<<endl;
cout<<"Circumferencr="<<circumference;
}
int main()
{
earth ob(930000000,365);
ob.CaluCircumference();
ob.Show();
return 0;
}
class planet{
protected:
double distance; //miles from the sun
int revolve; //in days
public:
planet(double d,int r)
{distance=d;
revolve=r;
}
};
class earth:public planet{
double circumference; //circumference of orbit
public:
earth(double d,int r):planet(d,r)
{
}
void CaluCircumference();
//(Hint:circumference=2*r*3.1416)*/
void Show();// that displays ther information. */
};
void earth::CaluCircumference()
{
circumference=2*revolve*3.1416;
}
void earth::Show()
{
cout<<"distance="<<distance<<endl;
cout<<"revolue="<<revolve<<endl;
cout<<"Circumferencr="<<circumference;
}
int main()
{
earth ob(930000000,365);
ob.CaluCircumference();
ob.Show();
return 0;
}
#7
#include <iostream.h>
class planet{
protected:
double distance; //日地距离
int revolve; //公转周期
public:
planet(double d,int r)
{distance=d;
revolve=r;
}
};
class earth:public planet{
double circumference; //公转轨道周长
public:
earth(double d,int r):planet(d,r){
circumference=2*3.1416*r;
}
show(){
cout<<"日地距离:"<<distance<<"公转轨道周长:"<<circumference<<endl;
}
};
main()
{
earth ob(930000000,365);
ob.show();
return 0;
}
class planet{
protected:
double distance; //日地距离
int revolve; //公转周期
public:
planet(double d,int r)
{distance=d;
revolve=r;
}
};
class earth:public planet{
double circumference; //公转轨道周长
public:
earth(double d,int r):planet(d,r){
circumference=2*3.1416*r;
}
show(){
cout<<"日地距离:"<<distance<<"公转轨道周长:"<<circumference<<endl;
}
};
main()
{
earth ob(930000000,365);
ob.show();
return 0;
}
#8
地5行的注释应该是地球半径