#include<iostream.h> class test { int a,b; public: test(int x,int y) { a=x; b=y; cout<<"调用构造函数test()"<<endl; } void print() { cout<<"两数相减得"<<a-b<<endl; } ~test() { cout<<"调用析构函数test()"<<endl; } }; void main() { int a1,b1; cout<<"请输入两个数"<<endl; cin>>a1>>b1; test t(a1,b1); t.print(); }