COMPLEX DATA TYPE (C++) Code a struct to implement the complex data type Car: 1. Data Members Name Quantity 2. Member Functions Default Constructor Parameter Constructor 3. Non-Member Functions Print Equivalent Compare string (full name) integer (number of cars) initialize name to "noname, quantity to 0 initialize data members to specified values one parameter: car c Print data member values two parameters: car c1, car c2 return true if data members are equivalent return false if data members are not equivalent three parameters, car c1, car c2, bool less return true if less is true and c1.quantity <= c2.quantity return false is less is false and c1.enrollment > c2.enrollment I need two files i) car.h (header file) ii) car.cpp (implementation file which will rely on car.h)
COMPLEX DATA TYPE (C++) Code a struct to implement the complex data type Car: 1. Data Members Name Quantity 2. Member Functions Default Constructor Parameter Constructor 3. Non-Member Functions Print Equivalent Compare string (full name) integer (number of cars) initialize name to "noname, quantity to 0 initialize data members to specified values one parameter: car c Print data member values two parameters: car c1, car c2 return true if data members are equivalent return false if data members are not equivalent three parameters, car c1, car c2, bool less return true if less is true and c1.quantity <= c2.quantity return false is less is false and c1.enrollment > c2.enrollment I need two files i) car.h (header file) ii) car.cpp (implementation file which will rely on car.h)
Related questions
Question
100%
c++ data structure
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 4 images
Follow-up Questions
Read through expert solutions to related follow-up questions below.
Follow-up Question
I am thankful to you. This looks like a complete program and very insightful. I have a question, in car.cpp file you have written
Car::Car(string name, int quantity) {
this->name = name;
this->quantity = quantity;
}
what does "this" mean? Can you elaborate a little? Or is there any other alternative that I can use instead of it?
Solution
by Bartleby Expert