You can delete line 13. Line 13 and line 4 are apparently redundant, or otherwise it's not clear what you wanted there.
You have declared a default constructor on line 15. A default constructor is a constructor which doesn't accept any arguments.
You should define that constructor by either:
1. adding a default-specifier
2. adding a member-initializer-list (optionally) and a body.
You can delete line 14. You don't need to define a destructor; the default one is fine in this case. If you prefer or are required, you can add a default-specifier.
# include <iostream>
// using namespace std;
// `using namespace` is strongly discouraged, especially for beginners.
// Don't use it. Call things by their full name.
class Vehicle {
public:
// default constructor
Vehicle() {} // alternatively Vehicle() = default;
// parametrized constructor
Vehicle(std::string vehicleType, int numberOfDoors, int maxSpeed)
: type {vehicleType}
, nDoors{numberOfDoors}
, speed {maxSpeed} {
}
// accessors
std::string getType() const { return type; }
int getNDoors() const { return nDoors; }
int getSpeed() const { return speed; }
// mutators
void setType (std::string vehicleType) { type = vehicleType; }
// use a name more descriptive than "setNumber"
void setNDoors(int numberOfDoors) { nDoors = numberOfDoors; }
void setSpeed (int maxSpeed) { speed = maxSpeed; }
private:
// reduce code duplication and verbosity in constructor body(ies) by
// using in-class initialzation where applicable:
// https://goo.gl/wLyadq
// notice that doing this allows the default constructor to be empty
std::string type { "SUV" };
int nDoors { 10 };
int speed { 3 };
};
int main() {
// prefer constexpr over const
constexprint numVehicles = 2;
// don't use garbage words in names "myXXX", "theYYY" "aZZZ", etc.,
Vehicle vehicles[numVehicles];
for (int i = 0; i < numVehicles; ++i){
// restrict the scope of names as much as possible
std::string type;
int nDoors;
int maxSpeed;
std::cout << "\nPlease enter the vehicle type " << i+1 << ": ";
std::getline(std::cin, type);
vehicles[i].setType(type);
std::cout << "Enter the amount of doors the vehicle have " << i+1 << ": ";
std::cin >> nDoors;
vehicles[i].setNDoors(nDoors);
std::cout << "Enter the maximum speed for the vehicle " << i+1 << ": ";
std::cin >> maxSpeed;
vehicles[i].setSpeed(maxSpeed);
}
for(int i = 0; i < numVehicles; ++i) {
std::cout << "Vehicle " << i+1 << " = " << vehicles[i].getType() << ", "
<< vehicles[i].getNDoors() << " doors, and "
<< vehicles[i].getSpeed() << " miles per hour.\n";
}
}