Home > Back-end >  c
c

Time:10-10

# include
using namespace std;
The class point {
Protected:
Double x;
Double y;
Public:
Void the set (double ix, double iy) {
X=xi; Y=yi;
}
Double xoffset () {
return x;
}
Double yoffset () {
The return of y;
}
Double Angle () {
Return (180/3.14159) * atan2 (y, x);
}
Double radius () {
Return SQRT (x * * y x + y);
}
}
Int main () {
Point p;
Double x, y;

Cout<& lt;" Enter the x and y: \ n ";
Cin> X> y;

P. et (x, y);
P.x +=5;
P.y +=6;

Cout<& lt;" Angle="& lt; <& lt;" , the radius="& lt; <& lt;" , x offset="& lt; <& lt;" , y offset="& lt; }

What's wrong with this program? For help

CodePudding user response:

Feel helpless ~
This is a completely new ~
Did you see the compiler error message?

CodePudding user response:

I'll give you a list,
1. # include & lt; iostream>
This does not contain the
2. The back of the class} without;
3.
 
Void the set (double ix, double iy) {
X=xi; Y=yi;
}

The variable name to write wrong should be written in ix and xi
4.
 
Protected:
Double x;
Double y;

X, y is protected, how do you direct access to the main inside?
5.
The final statement of the;

CodePudding user response:

Say bad, this program has been disastrous ~
Good refueling ah ~ ~

CodePudding user response:

Help to change the displayed prominently
Just learning c + +, many don't understand

CodePudding user response:

 
#include
#include
#include

using namespace std;

The class point
{
Public:
Double x;
Double y;
Public:
Void the set (double ix, double iy)
{
X=ix.
Y=iy;
}
Double xoffset ()
{
return x;
}
Double yoffset ()
{
The return of y;
}
Double Angle ()
{
Return (180/3.14159) * atan2 (y, x);
}
The double radius ()
{
Return SQRT (x * * y x + y);
}
};
Int main ()
{
Point p;
Double x, y;

Cout<& lt;" Enter the x and y: \ n ";
Cin> X> y;

P. et (x, y);
P.x +=5;
P.y +=6;

Cout<& lt;" Angle="& lt; <& lt;" , the radius="& lt; <& lt;" , x offset="& lt; <& lt;" , y offset="& lt;
System (" pause ");
return 0;
}

Debugging error is also important to the learning process,
Hope I can come up with more detailed questions, with an error message,
Again here is the c + + Builder area,