#includeiostreamusing namespace std;class pro public void showint ifloat bstring c; ; void proshowint i =1float b=89string c=abc couta i bbc cendl; int main pro m; mshow8910sjw; return 0; 如何修
要修改输出b的值为9.10,需要在main函数中调用show函数时传入正确的参数。修改后的代码如下:
#include<iostream>
using namespace std;
class pro{
public:
void show(int i, float b, string c);
};
void pro::show(int i, float b, string c){
cout<<"a "<<i<<" b "<<b<<" c "<<c<<endl;
}
int main(){
pro m;
m.show(8, 9.10, "sjw");
return 0;
}
在调用show函数时,将参数9.10传入b的位置即可实现输出b为9.10的效果。
原文地址: http://www.cveoy.top/t/topic/iT58 著作权归作者所有。请勿转载和采集!