试在下列程序中________处填入适当的语句使程序运行后输出: x = 5 y = 27x = 10 y = 27#include iostream使用命名空间标准;类样本私人:整数 x;静态 int y;____公众:______________ 1样品整数;无效打印;;Sample::Sampleint ax = a;y++;void Sample:p rintcout x = x
#include
class Sample{ private: int x; static int y; public: Sample(int); void print(); };
Sample::Sample(int a){ x = a; y++; } void Sample::print(){ cout << "x = " << x << ", y = " << y << endl; }
int Sample::y = 25;
int main(){ Sample s1(5); Sample s2(10); s1.print(); s2.print(); Sample::y = 27; //(1) s1.print(); s2.print(); system("pause"); return 0; }
原文地址: http://www.cveoy.top/t/topic/hvgz 著作权归作者所有。请勿转载和采集!