俺是个新手,大哥们帮帮忙啊!!!

ertun110 2009-05-13 06:13:27
#include<iostream>
using namespace std;
struct Point{
private:
double x,y;
public:
Point(){};
Point(double a,double b)
{x=a;y=b;}
void Display(){cout<<x<<"\t"<<y<<endl;}
};
void main(){
Point a;
Point b(18.5,10.6);
a.Setxy(10.6,18.5);
a.Display();
b.Display();
}



E:\学习\Microsoft Visual Studio\Common\451\5666.cpp(15) : error C2039: 'Setxy' : is not a member of 'Point'
E:\学习\Microsoft Visual Studio\Common\451\5666.cpp(3) : see declaration of 'Point'
执行 cl.exe 时出错.
...全文
70 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
ertun110 2009-05-13
  • 打赏
  • 举报
回复
往哪里加 SETXY() 说清楚点好吗 谢谢
xpp1223 2009-05-13
  • 打赏
  • 举报
回复
#include <iostream>
using namespace std;
struct Point{
private:
double x,y;
public:
Point(){};
Point(double a,double b)
{x=a;y=b;}
void Setxy(double c, double d)
{
x=c;
y=d;

}
void Display(){cout <<x <<"\t" <<y <<endl;}
};
void main(){
Point a;
Point b(18.5,10.6);
a.Setxy(10.6,18.5);
a.Display();
b.Display();
}

你没有定义 SETXY() 这个函数
xpp1223 2009-05-13
  • 打赏
  • 举报
回复
setxy(),什么东东

65,211

社区成员

发帖
与我相关
我的任务
社区描述
C++ 语言相关问题讨论,技术干货分享,前沿动态等
c++ 技术论坛(原bbs)
社区管理员
  • C++ 语言社区
  • encoderlee
  • paschen
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
  1. 请不要发布与C++技术无关的贴子
  2. 请不要发布与技术无关的招聘、广告的帖子
  3. 请尽可能的描述清楚你的问题,如果涉及到代码请尽可能的格式化一下

试试用AI创作助手写篇文章吧