Vehicle Class:
class Vehicle
{
public:
virtual double topSpeed() const = 0;
virtual void display(std::ostream&) const = 0;
virtual std::string condition() const = 0;
virtual ~Vehicle() {};
};
Car Class:
class Car : public Vehicle
{
std::string m_maker;
std::string m_condition;
int m_topSpeed;
public:
Car(std::istream&);
std::string condition() const;
double topSpeed() const;
void display(std::ostream& out) const;
};
I need to use the Car(std::istream&) function to extract comma seperated data from a .txt file using STL containers and iterators.
.txt file below:
c, Toyota , n, 157
c, Honda , b, 145
c, Chrysler, n, 173
Using that function above, i need to get each value seperately in the following format:
TAG | MAKER | CONDITION | TOP_SPEED |
tag is the "c", maker is the "car name", condition is the "n/b" and speeds are the int values.
Aucun commentaire:
Enregistrer un commentaire