能帮我写一下这个程序吗?

求C++大神帮我写一下这个程序可以吗,拜托拜托了[可怜脸]_百度知道
求C++大神帮我写一下这个程序可以吗,拜托拜托了[可怜脸]
我有更好的答案
&Point{ &(float&const&float&
virtual&this-&y&x&&void&PI=3.14;&&
cout&&&圆柱的纵坐标坐标为:&&&this-&using&namespace&
cout&&&圆柱的面积为;&&lt.0;
~Circle(){
}& &&void&class&Point{ public:&
&h;float&getVol(){&nbsp,&float&h){
virtual&------------&x;=&x;
this-&y&h&=&&//定义点类&nbsp:&
virtual&getVol()&lt:
float& this-&
cout&&&圆柱的体积为:&&&getVol()&&
cout&&&------------&&&&&
virtual&~Cylinder(){
}& private:
float&h;&};&//定义圆锥类&class&Cone:public&Circle{ public: & Cone(float&x,&float&y,&float&&r,&float&h){
& this-&x&=&x;&
this-&y&=&y;
this-&r&=&r;
this-&h&=&h;&
virtual&float&getArea(){&
return&PI*r*r*2&+&2*PI*r*h&;&
virtual&float&getVol(){&
return&PI*r*r*h/3.0;&
virtual&void&printInfo(){
cout&&&圆锥的横坐标坐标为:&&&this-&x&&&
cout&&&圆锥的纵坐标坐标为:&&&this-&y&&
cout&&&圆锥的面积为:&&&getArea()&&&
cout&&&圆锥的体积为:&&&getVol()&&&
cout&&&------------&&&&
virtual&~Cone(){
} private:
float&h;&};&//计算总面积&float&getTotalArea(Point*&p[],int&n){ int&i=0; float& for(i=0;&i&n;&i++){
sum+=p[i]-&getArea();& }& return&&}//计算总体积&float&getTotalVol(Point*&p[],int&n){ int&i=0; float& for(i=0;&i&n;&i++){
sum+=p[i]-&getVol();& }& return&&}&//输出所有图形信息void&getAllInfo(Point*&p[],int&n){ int&i=0; for(i=0;&i&n;&i++){
cout&&&第&&&i+1&&&个图形信息:&&&&
p[i]-&printInfo();& }&}&int&main(){ int&num&=&0; int&i=0; int&x,y; float&r,h;& int&choice=0;& cout&&&请输入要生成的图形个数&&& cin&& Point**&obj&=&new&Point*[num];& for(i=0;&i&&i++)&{
cout&&&请选择第&&&i+1&&&个图形形状(0.点;1.圆;2.圆柱;3.圆锥):&;
switch(choice){
cout&&&x=&;
cout&&&y=&;
obj[i]=new&Point(x,y);
cout&&&x=&;
cout&&&y=&;
cout&&&r=&;&
obj[i]=new&Circle(x,y,r);
cout&&&x=&;
cout&&&y=&;
cout&&&r=&;&
cout&&&h=&;
obj[i]=new&Cylinder(x,y,r,h);
cout&&&x=&;
cout&&&y=&;
cout&&&r=&;&
cout&&&h=&;
obj[i]=new&Cone(x,y,r,h);
cout&&&选择无效请重新输入!&&&
}& } getAllInfo(obj,num); cout&&&总面积为:&&&getTotalArea(obj,num)&& cout&&&总体积为:&&&getTotalVol(obj,num)&&&& delete[]&&& return&0;&}复杂版实现----------------------------------有疑问欢迎追问:
cout&&&圆的面积为:&&&getArea()&void&getArea()&&y&&
cout&&&点的面积为:&&&getArea()&this-&x&lt:
float&r;};&//定义圆柱类class&C&0:&&
cout&&getVol(){
return&PI*r*r*h&;&&+&PI*r*sqrt(r*r+h*h)&;&y&&y){
&this-&y&this-&x&点的纵坐标坐标为:&&&this-&float&getArea(){&
return&y;&&
cout&圆的体积为:&&&quot:public&getArea(){
return&PI*r*r;&y;r;------------&y&=&=0.0;&
virtual&float&&printInfo(){
cout&&&圆柱的横坐标坐标为:&&&this-&gt:&float&y,&float&&&
}&PI*r*r*2&&&
virtual&=&r;&
virtual&float&this-&x&&printInfo(){
cout&&&圆的横坐标坐标为;
this-&gt:public&getArea(){
return&0.0;&
}&float&y,&float&&
Point(float&x,&float&&&=&y;&
}&x&=&&printInfo(){
cout&&&点的横坐标坐标为;x;&r){
this-&x&&r;class&C&
}&nbsp,&&&&&//定义圆类&y&&r&=&
virtual&float&&&&
this-&gt#include&iostream&#include&cmath&点的体积为;&&this-&x&=&x;
&x;getVol()&&
virtual&~Point(){
Circle&=&y;
this-&r&圆的纵坐标坐标为:&&&this-&&&};=0.0;
&nbsp,&&Circle{ public:
Cylinder(float&&lt
采纳率:71%
自己去t-ao--bao
,收一下就搞定了
不过看不清楚
可不可以帮帮忙
图片看不清楚
可不可以帮帮忙
其他1条回答
为您推荐:
其他类似问题
换一换
回答问题,赢新手礼包
个人、企业类
违法有害信息,请在下方选择后提交
色情、暴力
我们会通过消息、邮箱等方式尽快将举报结果通知您。有哪位能帮我解释一下这个程序吗?每一步都是做什么用的?我是C语言的初学者看不太懂这个程序!_百度知道
有哪位能帮我解释一下这个程序吗?每一步都是做什么用的?我是C语言的初学者看不太懂这个程序!
#include&reg52.h&
#define uint unsigned int
#define uchar unsigned char
#define LED P3
uchar code TAB[]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f};
unsigned char a,i;
void init();
void display();
我有更好的答案
a=20,也就是1秒钟变一下temp值; TMOD=0x01; TH0=()&#47,P1口不知道接的是什么;/&#47,装入初值
{ temp=0,y;void init();i++)
{ delay(100);
LED=(LED&&1);数码管显示;
for(x=0,i;用uint代替unsigned int#define uchar unsigned char
&#47#include&reg52.h&
/延时函数{给一盏灯亮
for(i=0;i&
temp++;256;定时器函数;/同上#define LED P3
unsigned long int temp..;//
a++,0x06,0x5b;
TL0=()%256;/声明函数void display();/while语句循环,单片机会一直在里边循环,除非有中断
LED=0xfe,0x07,0x7f;//// TR0=1; void timer0() interrupt 1
//x&z;x++)
for(y=1。{
TH0=()&#47.{
P0=TAB[temp];/数码管显示
}}void init()
/ &#47..;/开定时器;void delay(unsigned char );void main(){
init();/数码管显示1到10
if(temp==10) temp=0;
}}void display()
//加载头文件#define uint unsigned int
&#47,0x6d,0x7d;8;/P3口应该接八个灯吧uchar code TAB[]={0x3f;
if(a==20) {
a=0;y&600;y++);256;循环左移实现流水灯功能
display();
&#47,0x4f,0x66;不断读table里面的书显示0到10
delay(1);}void delay(unsigned char
/ TL0=()%256; EA=1; ET0=1,0x6f}
采纳率:10%
为您推荐:
其他类似问题
您可能关注的内容
c语言的相关知识
换一换
回答问题,赢新手礼包
个人、企业类
违法有害信息,请在下方选择后提交
色情、暴力
我们会通过消息、邮箱等方式尽快将举报结果通知您。An error occurred on the server when processing the URL. Please contact the system administrator.
If you are the system administrator please click
to find out more about this error.扫二维码下载作业帮
拍照搜题,秒出答案,一键查看所有搜题记录
下载作业帮安装包
扫二维码下载作业帮
拍照搜题,秒出答案,一键查看所有搜题记录
谁能帮我改一下这个程序,输入某年某月某日,判断这一天是这一年的第几天?1.程序分析:以3月5日为例,应该先把前两个月的加起来,然后再加上5天即本年的第几天,特殊       情况,闰年且输入月份大于3时需考虑多加一天.*/#includeint main (){int a,b,c,d,printf("请输入年月日:");scanf("%d,%d,%d",&a,&b,&c);switch(b){case 1:sum=0; case 2:sum=31; case 3:sum=59; case 4:sum=90; case 5:sum=120; case 6:sum=151; case 7:sum=181; case 8:sum=212; case 9:sum=243; case 10:sum=273; case 11:sum=304; case 12:sum=334; }if(a%100!=0&&a%4==0||a%100==0&&a%400==0)d=1;elsed=0;if(d=1&&b>3){sum=sum+1;}sum=sum+c;printf("这一天是第%d年的第%d天.",a,sum);}
作业帮用户
扫二维码下载作业帮
拍照搜题,秒出答案,一键查看所有搜题记录
if(d=1&&b&3),这里要d==1逗号隔开输入&
为您推荐:
其他类似问题
扫描下载二维码16:52 提问
谁能帮我写一个java抽奖小程序
要求如下:
1. 使用图形用户界面
2. 能够在电脑上抽奖,分别抽取3等奖、2等奖、1等奖和特等奖,设定每种奖项的人数后分别一次抽取每个奖项
3. 按给定的总人数以序号或电话号码为抽奖依据
4. 要求屏幕上能够显示抽奖的号码滚动过程,按“停止”按钮给出抽奖结果
按赞数排序
公司年会抽奖程序,交给你来写么?
不是,就大学的一个课程设计,我要代码的
我就想问一下,你的数据是从哪来的,电话号码你是从拿得到,有数据的接口吗?还是有写好的数据
只要纯前端代码就可以,数据可以提前输入到文件,当成静态数据处理
邮箱给我,我给你发一个直接可以用的
百度 一搜,一大把。
网络这类代码很多,一大把吧
准确详细的回答,更有利于被提问者采纳,从而获得C币。复制、灌水、广告等回答会被删除,是时候展现真正的技术了!
其他相关推荐

我要回帖

 

随机推荐