单项选择题

已知:int n=10;那么下列语句中错误的是

A) int*p=new long[n];
B) int p[n];
C) int*p=new long(n);
D) int p[10];
<上一题 目录 下一题>
热门 试题

单项选择题
有以下类定义 class Point public: Pointint x = 0, int y=0) _x = x; _y = y; void Move int xoff, int yoff) _x +=xoff;_y+=yoff; void Print() const cout<<'('<<_x<<','<<_y<<')' << end1; private: int_x,_y; ; 下列语句中会发生编译错误的是 A) Point pt;pt.Print(); B) const Point pt;pt.Print(); C) Point pt;pt.Move(1, 2); D) const Point pt;pt.Move(1, 2)
单项选择题
下列程序的输出结果是( )。 #include<iostream> using namespace std; class TestClass static int i; public: TestClass()i++; ~TestClass()i--; static int getVal()retum i; ; int TestClass∷i=0; void fun()TestClass ob2;cout<<ob2.getVal(); int main() TestClass obi; fun(); TestClass*ob3=new TestClass;cout<<ob3->getVal(); delete ob3;cout<<TestClass∷getVal(); retum 0;
A) 111
B) 121
C) 211
D) 221
相关试题
  • C
  • C
  • 下列程序的输出结果是 #include<iostrea...
  • 模板参数表中参数使用的分隔符号是 ___...
  • 下面描述正确的是( )。