对于以下的变量定义,表达式______是不正确的。struct { float x, y;} point, *p=&point;
A: p->x=2.0
B: (*p).y=3.0
C: point.x=2.0
D: *p->y=3.0
A: p->x=2.0
B: (*p).y=3.0
C: point.x=2.0
D: *p->y=3.0
举一反三
- 对于以下的变量定义,表达式______是不正确的。struct { float x, y;} point, *p=&point;
- 下面定义结构体数组的代码段正确的是()。 A: struct POINT{ public double x;//横坐标 public double y;//纵坐标}POINT[] p;p=new POINT[100]; B: struct POINT{ public double x;//横坐标 public double y;//纵坐标}POINT p[100]; C: struct POINT{ public double x;//横坐标 public double y;//纵坐标}POINT p[]=new POINT[100]; D: struct POINT{ public double x;//横坐标 public double y;//纵坐标}POINT p=new POINT[100];
- 已知:Point x(3,4); 则下列声明中能定义p指针变量并使其初值指向x的是( ) 。 A: int &p=x; B: Point *p=&x; C: Point p=x; D: float *p=&x;
- If X and Y are measured in the same units and we consider a point that lies below a 45° line, then we know that for the X and Y combination associated with this point, <p></p>
- 有以下程序: #include <iostream> #include <cmath> using namespace std; class Distance; class point { public: friend class Distance; Point(int a,int B) { x=a; Y=b; } void Print() { cout<<"X= "<<X<<end1; cout<<"Y= "<<Y<<end1; } private: float X,Y; }; class Distance { public: float Dis(Point &p,Point &q); }; float Distance :: Dis(Point &p,Point &q) { float result; result=sqrt((p.X-q.X)*(p.X-q.X)+(p.Y-q.Y)*(p.Y-q.Y)); cout<<result<<end1; retUrn result; } int main() { Point p(10,10),q(10,30); Distance d; d.Dis(p,q); return 0; } 运行后的输出结果是( )。 A: 10 B: 30 C: 0 D: 20