各位c++高手请帮帮小弟吧!修改我的程序

[复制链接]
查看11 | 回复1 | 2007-11-13 17:17:22 | 显示全部楼层 |阅读模式
#include class Test {public: Test(int a,int b);
//这个自定义函数前面加void或根据返回值定int char...~Test(); print(int a,int b); //voidprivate: int x,y; }; Test::Test(int a,int b) {x=a; y=b; cout<<"构造函数被调用"<<endl; } Test::~Test () {cout<<"析构函数被调用"<<endl;} Test::print (int x,int y) {int sum; sum=x-y; cout<<x<<"-"<<y<<"="<<sum<<endl; } void main() {Test t(88,32); t.print(); }
回复

使用道具 举报

千问 | 2007-11-13 17:17:22 | 显示全部楼层
print()没写返回类型应该是void
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行