#include<iostream>
using namespace std;
double swapr(double &a);
double swapp(double *q);
double swapv(double a);
int main()
{
system ("color e");
double a;
cout<<"  原始的两值为:a=";
cin>>a;
//cout<<"a="<<a<<endl;
cout<<"采用引用传递后:";
cout<<"a的立方为:"<<swapr(a)<<' ';
cout<<"原a值a="<<a<<endl;
cout<<"采用指针传递后:";
cout<<"a的立方为:"<<swapp(&a)<<' ';
cout<<"原a值a="<<a<<endl;
cout<<"  采用值传递后:";
cout<<"a的立方为:"<<swapv(a)<<' ';
cout<<"原a值a="<<a<<endl;
return 0;
}
double swapr(double &a)
{
return a*=a*a;
}
double swapp(double *q)
{
return (*q)*=(*q)*(*q);
}
double swapv(double b)
{
return b*=b*b;
}
/*
    原始的两值为:a=2
采用引用传递后:a的立方为:8 原a值a=8
采用指针传递后:a的立方为:512 原a值a=512
  采用值传递后:a的立方为:1.34218e+008 原a值a=512
Press any key to continue

*/