各种虚拟币:dev-cpp出问题拉???

来源:百度文库 编辑:高考问答 时间:2024/05/16 00:39:14
我在dev-cpp和tc++3.0中得到了不同的结果:
#include<iostream.h>
int fun(int &a,int =2);
int main()
{
int x=4,y=3;
cout<<fun(x)<<','<<x<<endl;
cout<<x<<','<<fun(x,y)<<endl;
return 0;
}
int fun(int &a,int b)
{
a*=b;
return a-b;
}
在dev-cpp中:6,8
24,21
在tc++3.0中:6,4
24,21

在DEV-CPP中对,因为a是传饮用进去的,所以fun函数会改变a的值.