河南成教 / 面向对象程序设计
1[应用题]
1[应用题]
请在横线中填入程序,完成如下PID控制仿真程序. (注意符号、标点符号、括号用半角)
#include
class AAA
{
int A,B;
public:
AAA()
{A=100;B=200;
cout<<"deflat constructing
";
}
AAA(int i,int j)
{A=i,B=j;
cout<<"constructing
";}
~AAA(){cout<<"destructing
";}
void print( )
{cout<<><><><"
";}>
friend int add(AAA &s1);
};
int add(AAA &s1)
{return (s1.A s1.B);}
void main()
{AAA a1,*a2;
int s;
a2=new AAA(5,6);
a1.print();
a2->print();
s=add(*a2);
cout<<”s=”<<><>
delete a2;
}
运行结果是:
参考答案:
佳题速递: