⺣ - רҵ·ĵϷƽ̨

ǰλãҳ > 自考C试题及答案套合集 - 百度文库

自考C试题及答案套合集 - 百度文库

  • 62 Ķ
  • 3
  • 2026/1/10 15:45:23

void swap(int &a,int &b) {a=a+b; b=a-b; a=a-b; }

void main() {int a=19,b=15;

cout<<\swap(&a,&b); swap(a,b); cout<<\}

5. #include void main() {int i(3),j(8);

int * const p=&i; int *p=&i; cout<<*p<

cout<<*p<

ġɳ(⹲5С⣬ÿС4֣20)

1. ߴʵݣʹִнΪ\

#include #include using namespace std; class mystring {public:

char * pdata; mystring(int len)

{pdata=new charlen+1; }

~mystring() {delete pdata;}

void show(){cout<

void fun(mystring** array,int len) {mystring*old=*array;

_*array=new mystring(len)______; memcpy(*array, old, len); }

void main()

{mystring str(20); mystring*pstr=&str; mystring**ppstr=&pstr;

strcpy(str.pdata,\fun(ppstr, 20); str.show();_______ }

2. ߴʵ־䣬Ķ塣 class line;

class box { private: int color; int upx, upy; int lowx, lowy; public:

friend int same_color(line l, box b); void set_color (int c){color=c;}

void define_box (int x1, int y1, int x2, int y2) {upx=x1;upy=y1;lowx=x2;lowy=y2;} };

class line { private: int color;

int startx, starty; int endx, endy; public:

friend int same_color(line l,box b); void set_color (int c) {color=c;}

void define_line (int x1,int y1,int x2,int y2) {startx=x1;starty=y1;endx=x2;endy=y2;} };

int same_color(line l, box b) {if (l.color==b.color) return 1; return 0; }

3. ֱб߳ȡ #include #include class Point {private: double x,y;

friend Line;__________ public:

Point(double i=0,double j=0) {x=i;y=j;}

Point(Point &p) {x=p.x;y=p.y;} };

class Line {private: Point p1,p2; public:

Line(Point &xp1,Point &xp2):p1(xp1),p2(xp2)________{} double GetLength(); };

double Line::GetLength() {double dx=p2.x-p1.x; double dy=p2.y-p1.y;

return sqrt(dx*dx+dy*dy);

}

void main()

{ Point p1,p2(6,8); Line L1(p1,p2);

cout<

4. ĵ׻ߴʵ־䣬ʹóִнΪ40 #include class Test { public:

static int x______; Test (int i=0) {x=i+x;} int Getnum()

{return Test::x+7;} };

int Test::x=33_______; void main() {Test test;

cout<

5. гĿոʵ־䣬ʹΪ0210 #include #include class Magic {double x; public:

Magic(double d=0.00):x(fabs(d)) {}

Magic operator+(Magic &c______) {

return Magic(sqrt(x*x+c.x*c.x)); }

friend ostream& operator<<(ostream & stream,Magic & c) { stream<

void main() {Magic ma;

cout<

塢(⹲2С⣬ÿС5,10) 1. гдִеĽ

#include void main() {int a,b,c; char ch;

cin>>a>>ch>>b>>c;//Ӽ1.5c1020,ʾһո cout<

0

2.

#include class A {public: A()

{cout<<\virtual ~A()

{cout<<\virtual void f()

{cout<<\void g() {f();} };

class B:public A {public: B()

{f();cout<<\~B()

{cout<<\};

class C:public B {public: C()

{cout<<\~C()

{cout<<\void f()

{cout<<\};

void main() {A *a=new C; a->g(); delete a; }

As cons. As f(). Bs cons. Cs cons. Cs f(). Cs des. Bs des. As des.

  • ղ
  • Υٱ
  • Ȩ
ĵ10.00 Ԫ VIP
ߣ...

92ƪĵ

ĵ飺

void swap(int &a,int &b) {a=a+b; b=a-b; a=a-b; } void main() {int a=19,b=15; cout<<\swap(&a,&b); swap(a,b); cout<<\} 5. #include void main() {int i(3),j(8); int * const p=&i; int *p=&i; cout<<*p<

οͿͨغɸƺŰ棩
ƪ
ʱؼۣ10 Ԫ/ ԭ:20Ԫ
VIP
ؼۣ29 Ԫ/ ԭ:99Ԫ
0.3 Ԫ/ ÿ150
ȫվɸ
VIP
ؼۣ29 Ԫ/ ԭ:99Ԫ
0.3 Ԫ/ ÿ150
ȫվɸ
עĵпܡֻĿ¼ݲȫ֮ǰעѸ޷ػ⣬ϵЭ㴦
΢ţfanwen365 QQ370150219
Copyright © ⺣ All Rights Reserved. ICP16052595-3 վͼ ͷQQ370150219 䣺370150219@qq.com