/****************************************************************************** Welcome…
- User
/******************************************************************************
Welcome to GDB Online. GDB online is an online compiler and debugger tool for C, C++, Python, Java, PHP, Ruby, Perl, C#, OCaml, VB, Swift, Pascal, Fortran, Haskell, Objective-C, Assembly, HTML, CSS, JS, SQLite, Prolog. Code, Compile, Run and Debug online from anywhere in world.
*******************************************************************************/ #include #include
using namespace std;
struct Car { float length; float clearance; float engineVolume; int enginePower; int wheelDiameter; std::string color; std::string transmissionType; };
void setValues(Car& car, float length, float clearance, float engineVolume, int enginePower, int wheelDiameter, const string& color, const string& transmissionType) { car.length = length; car.clearance = clearance; car.engineVolume = engineVolume; car.enginePower = enginePower; car.wheelDiameter = wheelDiameter; car.color = color; car.transmissionType = transmissionType; }
void displayValues(const Car car) { cout << "Length: " << car.length << endl; cout << "Clearance: " << car.clearance << endl; cout << "Engine Volume: " << car.engineVolume << endl; cout << "Engine Power: " << car.enginePower << endl; cout << "Wheel Diameter: " << car.wheelDiameter << endl; cout << "Color: " << car.color << std::endl; cout << "Transmission Type: " << car.transmissionType << endl; }
bool findValue(const Car car, const string& value) { return car.color == value || car.transmissionType == value; }
int main() {
Car myCar; setValues(myCar, 4.5, 0.3, 2.5, 350, 18, "red", "automatic"); displayValues(myCar); string searchValue = "red"; if (findValue(myCar, searchValue)) { cout << "Car has the value " << searchValue << endl; } else { cout << "Car does not have the value " << searchValue << endl; } return 0;} измени в коде данные с типом string на символьные динамические массивы
- Assistant
/****************************************************************************** Welcome to GDB Online. GDB online is an online compiler and debugger tool for C, C++, Python, Java, PHP, Ruby, Perl, C#, OCaml, VB, Swift, Pascal, Fortran, Haskell, Objective-C, Assembly, HTML, CSS, JS, SQLite, Prolog. Code, Compile, Run and Debug online from anywhere in world. *******************************************************************************/ #include #include
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.