// CarRateApp2.cpp : This file contains the 'main' function. Program execution begins and ends there.
//
#include <iostream>
#include <string>
class Car
{
public:
std::string brand;
std::string color;
int engineVol;
double price;
Car(std::string brandIn, std::string colorIn, double priceIn, int engineVolIn) {
brand = brandIn;
color = colorIn;
price = priceIn;
engineVol = engineVolIn;
};
bool WriteCar() {
std::cout << "Hello. The car stats are as follows:\n";
std::cout << "\nModel: " << brand;
std::cout << "\nColor: " << color;
std::cout << "\nEngine volume: " << engineVol <<" liters";
std::cout << "\nprice: $" << price;
return true;
};
double PriceDiff(double budget) {
double res = price - budget;
if (res > 0){
std::cout << "\nYou don't have enough money. You need " << res << " more to buy this car";
}
else
{
std::cout << "\nYou can buy the car. You will have $" << res << " left.";
}
return res;
};
void CheckEngine(Car otherCar) {
if (engineVol > otherCar.engineVol) {
std::cout << "\nThe car " << brand << " has bigger engine volume";
}
else if (engineVol < otherCar.engineVol)
{
std::cout << "\nThe car " << otherCar.brand << " has bigger engine volume";
}
else
{
0 коментара
За да коментирате, трябва да сте влезли в профила си.
Влезте