#include<iostream.h>
#include<cmath>
using namespace std;
class point{
public:
double x;
double y;
void set(double, double);
void Set(double ix,double iy){
x=ix;
y=iy;
}
double xoffset(){
return x;
}
double yoffset(){
return y;
}
double angle(){
return (180/3.14159)*atan2(y,x);
}
double radius(){
return sqrt(x*x+y*y);
}
};
int main(){
point p;
double x,y;
cout<<"enter x and y:\n";
cin>>x>>y;
p.set(x,y);
p.x+=5;
p.y+=6;
cout<<"angle="<<p.angle()
<<",radius="<<p.radius()
<<",x offset= "<<p.xoffset()
<<",yoffset= "<<p.yoffset()<<endl;
}
8 个解决方案
#1
汗,你的point类中只有set函数的声明而没有实现,你后面又使用set函数,当然要报链接错误了。
但是你的类中有一个Set函数的实现,是不是大小写搞错了?把那改过来就ok了
但是你的类中有一个Set函数的实现,是不是大小写搞错了?把那改过来就ok了
#2
弱弱的问句 怎么实现啊?
#3
它编译的时间是出现了一个警告!E:\c++编译器\MinGWStudio\MinGW\bin\..\lib\gcc\mingw32\3.4.2\..\..\..\..\include\c++\3.4.2\backward\backward_warning.h:32:2: warning: #warning This file includes at least one deprecated or antiquated header. Please consider using one of the 32 headers found in section 17.4.1.2 of the C++ standard. Examples include substituting the <X> header for the <X.h> header for C++ includes, or <iostream> instead of the deprecated header <iostream.h>. To disable this warning use -Wno-deprecated.
#4
#include<iostream>
#include<cmath>
using namespace std;
class point{
public:
double x;
double y;
void set(double ix,double iy){
x=ix;
y=iy;
}
double xoffset(){
return x;
}
double yoffset(){
return y;
}
double angle(){
return (180/3.14159)*atan2(y,x);
}
double radius(){
return sqrt(x*x+y*y);
}
};
int main(){
point p;
double x,y;
cout<<"enter x and y:\n";
cin>>x>>y;
p.set(x,y);
p.x+=5;
p.y+=6;
cout<<"angle="<<p.angle()
<<",radius="<<p.radius()
<<",x offset= "<<p.xoffset()
<<",yoffset= "<<p.yoffset()<<endl;
return 0;
}
#include<cmath>
using namespace std;
class point{
public:
double x;
double y;
void set(double ix,double iy){
x=ix;
y=iy;
}
double xoffset(){
return x;
}
double yoffset(){
return y;
}
double angle(){
return (180/3.14159)*atan2(y,x);
}
double radius(){
return sqrt(x*x+y*y);
}
};
int main(){
point p;
double x,y;
cout<<"enter x and y:\n";
cin>>x>>y;
p.set(x,y);
p.x+=5;
p.y+=6;
cout<<"angle="<<p.angle()
<<",radius="<<p.radius()
<<",x offset= "<<p.xoffset()
<<",yoffset= "<<p.yoffset()<<endl;
return 0;
}
#5
那个警告的意思是让你用include <iostream>来代替include <iostream.h>
因为iostream.h在标准里面已经被标注为deprecated。看看effective c++吧
因为iostream.h在标准里面已经被标注为deprecated。看看effective c++吧
#6
谢谢先 我再去仔细看看!
#7
长歌天下很厉害哦!!!!!
#8
为什么要区分大小写呢。。
#1
汗,你的point类中只有set函数的声明而没有实现,你后面又使用set函数,当然要报链接错误了。
但是你的类中有一个Set函数的实现,是不是大小写搞错了?把那改过来就ok了
但是你的类中有一个Set函数的实现,是不是大小写搞错了?把那改过来就ok了
#2
弱弱的问句 怎么实现啊?
#3
它编译的时间是出现了一个警告!E:\c++编译器\MinGWStudio\MinGW\bin\..\lib\gcc\mingw32\3.4.2\..\..\..\..\include\c++\3.4.2\backward\backward_warning.h:32:2: warning: #warning This file includes at least one deprecated or antiquated header. Please consider using one of the 32 headers found in section 17.4.1.2 of the C++ standard. Examples include substituting the <X> header for the <X.h> header for C++ includes, or <iostream> instead of the deprecated header <iostream.h>. To disable this warning use -Wno-deprecated.
#4
#include<iostream>
#include<cmath>
using namespace std;
class point{
public:
double x;
double y;
void set(double ix,double iy){
x=ix;
y=iy;
}
double xoffset(){
return x;
}
double yoffset(){
return y;
}
double angle(){
return (180/3.14159)*atan2(y,x);
}
double radius(){
return sqrt(x*x+y*y);
}
};
int main(){
point p;
double x,y;
cout<<"enter x and y:\n";
cin>>x>>y;
p.set(x,y);
p.x+=5;
p.y+=6;
cout<<"angle="<<p.angle()
<<",radius="<<p.radius()
<<",x offset= "<<p.xoffset()
<<",yoffset= "<<p.yoffset()<<endl;
return 0;
}
#include<cmath>
using namespace std;
class point{
public:
double x;
double y;
void set(double ix,double iy){
x=ix;
y=iy;
}
double xoffset(){
return x;
}
double yoffset(){
return y;
}
double angle(){
return (180/3.14159)*atan2(y,x);
}
double radius(){
return sqrt(x*x+y*y);
}
};
int main(){
point p;
double x,y;
cout<<"enter x and y:\n";
cin>>x>>y;
p.set(x,y);
p.x+=5;
p.y+=6;
cout<<"angle="<<p.angle()
<<",radius="<<p.radius()
<<",x offset= "<<p.xoffset()
<<",yoffset= "<<p.yoffset()<<endl;
return 0;
}
#5
那个警告的意思是让你用include <iostream>来代替include <iostream.h>
因为iostream.h在标准里面已经被标注为deprecated。看看effective c++吧
因为iostream.h在标准里面已经被标注为deprecated。看看effective c++吧
#6
谢谢先 我再去仔细看看!
#7
长歌天下很厉害哦!!!!!
#8
为什么要区分大小写呢。。