Unknown model· unknown
from NVIDIA HelpSteer3 Preference
C++ class representing a steam locomotive
- User
C++ class representing a steam locomotive
- Assistant
Here's a simple C++ class representing a steam locomotive:
cpp#include <iostream> #include <string> class SteamLocomotive { private: std::string name; std::string manufacturer; int buildYear; double weight; double maxSpeed; public: // Constructor SteamLocomotive(std::string name, std::string manufacturer, int buildYear, double weight, double maxSpeed) { this->name = name; this->manufacturer = manufacturer; this->buildYear = buildYear; this->weight = weight; this->maxSpeed = maxSpeed; } // Getters std::string getName() const { return name; } std::string getManufacturer() const { return manufacturer; } int getBuildYear() const { return buildYear; } double getWeight() const { return weight; } double getMaxSpeed() const { return maxSpeed; } // Setters void setName(std::string name) { this->name = name; } void setManufacturer(std::string manufacturer) { this->manufacturer = manufacturer; } void setBuildYear(int buildYear) { this->buildYear = buildYear; } void setWeight(double weight) { this->weight = weight; } void setMaxSpeed(double maxSpeed) { this->maxSpeed = maxSpeed; } // Display locomotive details void displayDetails() const { std::cout << "Name: " << name << std::endl; std::cout << "Manufacturer: " << manufacturer << std::endl; std::cout << "Build Year: " << buildYear << std::endl; std::cout << "Weight: " << weight << " tons" << std::endl; std::cout << "Max Speed: " << maxSpeed << " mph" << std::endl; } }; int main() { SteamLocomotive locomotive("Mallard", "LNER", 1938, 102.0, 126.0); locomotive.displayDetails(); return 0; }
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.