Created
May 14, 2025 15:22
-
-
Save vlaleli/4e2eece610a6fc0d48a3618b42f01fe2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <iostream> | |
| using namespace std; | |
| struct WashingMachine | |
| { | |
| char brand[50]; | |
| char color[20]; | |
| float width; | |
| float length; | |
| float height; | |
| float power; | |
| float spinSpeed; | |
| float heatingTemp; | |
| }; | |
| struct SteamIron | |
| { | |
| char brand[50]; | |
| char model[50]; | |
| char color[20]; | |
| float minTemp; | |
| float maxTemp; | |
| bool steamOutput; | |
| float power; | |
| }; | |
| struct Boiler | |
| { | |
| char brand[50]; | |
| float power; | |
| float capacity; | |
| float heatingTemp; | |
| }; | |
| struct Animal | |
| { | |
| char name[50]; | |
| char species[50]; | |
| char breed[50]; | |
| int age; | |
| char color[20]; | |
| void initialize() | |
| { | |
| cout << "Enter animal's name: "; | |
| cin >> name; | |
| cout << "Enter animal's species: "; | |
| cin >> species; | |
| cout << "Enter animal's breed: "; | |
| cin >> breed; | |
| cout << "Enter animal's age: "; | |
| cin >> age; | |
| cout << "Enter animal's color: "; | |
| cin >> color; | |
| } | |
| void display() | |
| { | |
| cout << "Animal Details:" << endl; | |
| cout << "Name: " << name << endl; | |
| cout << "Species: " << species << endl; | |
| cout << "Breed: " << breed << endl; | |
| cout << "Age: " << age << " years" << endl; | |
| cout << "Color: " << color << endl; | |
| } | |
| void makeSound() | |
| { | |
| cout << name << " says: Woof!" << endl; | |
| } | |
| }; | |
| int main() | |
| { | |
| WashingMachine wm; | |
| strcpy(wm.brand, "LG"); | |
| strcpy(wm.color, "White"); | |
| wm.width = 60; | |
| wm.length = 60; | |
| wm.height = 85; | |
| wm.power = 2000; | |
| wm.spinSpeed = 1400; | |
| wm.heatingTemp = 90; | |
| cout << "Washing Machine Details:" << endl; | |
| cout << "Brand: " << wm.brand << endl; | |
| cout << "Color: " << wm.color << endl; | |
| cout << "Width: " << wm.width << " cm" << endl; | |
| cout << "Length: " << wm.length << " cm" << endl; | |
| cout << "Height: " << wm.height << " cm" << endl; | |
| cout << "Power: " << wm.power << " W" << endl; | |
| cout << "Spin Speed: " << wm.spinSpeed << " RPM" << endl; | |
| cout << "Heating Temperature: " << wm.heatingTemp << "C" << endl; | |
| SteamIron iron; | |
| strcpy(iron.brand, "Philips"); | |
| strcpy(iron.model, "GC5035"); | |
| strcpy(iron.color, "Blue"); | |
| iron.minTemp = 120; | |
| iron.maxTemp = 220; | |
| iron.steamOutput = true; | |
| iron.power = 2400; | |
| cout << "Steam Iron Details:" << endl; | |
| cout << "Brand: " << iron.brand << endl; | |
| cout << "Model: " << iron.model << endl; | |
| cout << "Color: " << iron.color << endl; | |
| cout << "Min Temperature: " << iron.minTemp << "C" << endl; | |
| cout << "Max Temperature: " << iron.maxTemp << "C" << endl; | |
| cout << "Steam Output: " << (iron.steamOutput ? "Yes" : "No") << endl; | |
| cout << "Power: " << iron.power << " W" << endl; | |
| Boiler boiler; | |
| boiler.power = 1500; | |
| boiler.capacity = 50; | |
| boiler.heatingTemp = 75; | |
| cout << "Boiler Details:" << endl; | |
| cout << "Brand: " << boiler.brand << endl; | |
| cout << "Power: " << boiler.power << " W" << endl; | |
| cout << "Capacity: " << boiler.capacity << " L" << endl; | |
| cout << "Heating Temperature: " << boiler.heatingTemp << "C" << endl; | |
| Animal animal; | |
| animal.initialize(); | |
| animal.display(); | |
| animal.makeSound(); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment