找回密码
 注册
搜索
热搜: 回贴
  • 前程无忧官网首页 有什么好的平台可以
  • 最新的销售平台 互联网营销的平台有哪
  • 制作网页的基本流程 网页制作和网页设
  • 【帝国CMS】输出带序号的列表(数字排
  • 网站建设公司 三一,中联,极东泵车的
  • 织梦 建站 织梦网站模版后台怎么更改
  • 云服务官网 哪些网站有免费的简历模板
  • 如何建网站要什么条件 建网站要用什么
  • 吉林市移动公司电话 吉林省退休人员网
  • 设计类毕业论文 网站设计与实现毕业论
查看: 1757|回复: 3

不知道这个程序为什么交不上去

[复制链接]
发表于 2009-11-6 01:34:29 | 显示全部楼层 |阅读模式 IP:江苏扬州
各位大哥大姐帮个忙啊!
这个程序在VC++上运行结果是正确的.但是在我们学校的交题系统却是编译错误:
Compile Error
54583\Main.cc: In function `int main()':
54583\Main.cc:68: error: no matching function for call to `Circle::Circle(int&, int&, Circle&)'
54583\Main.cc:32: note: candidates are: Circle::Circle(const Circle&)
54583\Main.cc:35: note: Circle::Circle(int, int, int)
Sample Input

R 10 20 10 20
C 20 10 10
R 3 3 4 5
E

Sample Output

Rectangle 1: Area=200 Perimeter=60 point=(10,20)
Circle 2: Area=314.159 Perimeter=62.8318 center point=(20,10)
Rectangle 3: Area=20 Perimeter=18 point=(3,3)
我的源代码如下:
#include<iostream.h>
#define PI 3.14159
class shape
{
int x,y;
public:
shape(int a,int b)
{x=a,y=b;}
virtual double GetArea()=0;
virtual double GetPerim()=0;
virtual void show()=0;
int getx()
{return x;}
int gety()
{return y;}
};
class Rectangle:public shape
{
protected:
int w,h;
public:
Rectangle(int a,int b,int c,int d);
double GetArea()
{return w*h;}
double GetPerim()
{return 2*(w+h);}
void show()
{cout<<": Area="<<GetArea()<<" Perimeter="<<GetPerim()<<" point=("<<shape::getx()<<","<<shape::gety()<<")"<<endl;}
};
Rectangle::Rectangle(int a,int b,int c,int d):shape(a,b),w(c),h(d)
{}
class Circle:public shape
{
protected:
int radius;
public:
Circle(int a,int b,int c):shape(a,b)
{radius=c;}
double GetArea()
{return PI*radius*radius;}
double GetPerim()
{return 2*PI*radius;}
void show()
{cout<<": Area="<<GetArea()<<" Perimeter="<<GetPerim()<<" center point=("<<shape::getx()<<","<<shape::gety()<<")"<<endl;}
};
int main()
{
int a,b,c,d,n=1;
//Rectangle r;
//Circle c;
char ch;
shape *p;
while(cin>>ch)
{
if(ch=='E') break;
if(ch=='R')
{
cin>>a>>b>>c>>d;
Rectangle r(a,b,c,d);
p=&r;
cout<<"Rectangle "<<n;
p->show();
//cout<<": Area="<<p->GetArea()<<" Perimeter="<<p->GetPerim()<<" point=("<<a<<","<<b<<")"<<endl;
n++;
// break;
}else if(ch=='C')
{
cin>>a>>b>>c;
Circle c(a,b,c);
p=&c;
cout<<"Circle "<<n;
p->show();
//cout<<": Area="<<p->GetArea()<<" Perimeter="<<p->GetPerim()<<" center point=("<<x<<","<<y<<")"<<endl;
n++;
// break;
}

}
return 0;
}
发表于 2009-11-6 01:34:30 | 显示全部楼层 IP:江苏扬州
既然在VC过了,你就理直气壮地埋怨学校的系统呗```
回复

使用道具 举报

发表于 2009-11-6 01:34:31 | 显示全部楼层 IP:江苏扬州
你们学校的交题系统用的是内核是GUNC++吧,标准不同而已。
回复

使用道具 举报

发表于 2009-11-6 01:34:32 | 显示全部楼层 IP:江苏扬州
应该是吧,莫名其妙的.
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|小黑屋|最新主题|手机版|微赢网络技术论坛 ( 苏ICP备08020429号 )

GMT+8, 2024-10-1 17:21 , Processed in 0.178267 second(s), 13 queries , Gzip On, MemCache On.

Powered by Discuz! X3.5

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表