<< "brand: " << brand << ", "Р << "mainFrequency: " << mainfrequency << ", "Р << "hardDisk: " << harddisk << endl;Р}Рputer::setId(int pId)Р{Р?id = pId;Р}Рputer::setMainFrequency(float pMainFrequency)Р{Р?//设置主频值Р?mainfrequency = pMainFrequency;Р}Рputer::setHardDisk(float pHardDisk)Р{Р?//设置硬盘大小Р?harddisk = pHardDisk;Р}Рint main()Р{Р?puter1(1001, "IBM", 1.8f, 500.f);Р?puter2 = computer1;Р?computer2.setId(1002);Р?computer2.setMainFrequency(2.f);Р?computer2.setHardDisk(1000.f);Р?puter3 = computer1;Р?computer3.setId(1003);Р?computer3.setMainFrequency(2.5f);Р?computer3.setHardDisk(1500.f);Р?puter4 = computer1;Р?computer4.setId(1004);Р?computer4.setMainFrequency(2.f);Р?computer4.setHardDisk(1200.f);Р?computer1.puter();Р?computer2.puter();Р?computer3.puter();Р?computer4.puter();Р?return 0;Р}Р⑸运行结果