| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 656 人关注过本帖
标题:这个程序有两个错误,请问要怎样改?
取消只看楼主 加入收藏
lijunVC
Rank: 1
等 级:新手上路
帖 子:18
专家分:0
注 册:2006-11-15
收藏
 问题点数:0 回复次数:2 
这个程序有两个错误,请问要怎样改?

#include<iostream.h>
class Point
{
public:
Point(){cout<<""<<endl;};
~Point(){}
void Display()
{ cout<<"x="<<x<<"y="<<y<<endl; }
protected:
float x,y;
};
class PointCircle:public Point
{
private:
float r;
public:
PointCircle(){cout<<""<<endl;};
~PointCircle(){}
void SetPointCircle(float X,float Y,float R)
{
double L,S;
x=X;y=Y;r=R;
L=2*3.1415*R;
S=3.1415*R*R;
}
void Display()
{cout<<x<<y<<L<<S<<endl;}
};
void main()
{
PointCircle p1;
p1.SetPointCircle(1,1,1);
p1.Display();
cout<<endl;
}

这个程序是定义一个点类Point,并由此派生出一个圆类.有两个错误
i:\p23941\p23941.cpp(27) : error C2065: 'L' : undeclared identifier
i:\p23941\p23941.cpp(27) : error C2065: 'S' : undeclared identifier
Error executing cl.exe.

P23941.exe - 2 error(s), 0 warning(s)
我想来想去还是没改出来....
哪位帮一下忙啊....
谢谢....

2006-12-01 11:04
lijunVC
Rank: 1
等 级:新手上路
帖 子:18
专家分:0
注 册:2006-11-15
收藏
得分:0 

各位,可是我运行出来结果还是不对啊,没有L,也没有S..........


2006-12-02 16:43
lijunVC
Rank: 1
等 级:新手上路
帖 子:18
专家分:0
注 册:2006-11-15
收藏
得分:0 
谢谢......可以了...

2006-12-08 10:22
快速回复:这个程序有两个错误,请问要怎样改?
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.015802 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved