Forget the compiler errors. They are the least of your problems - in fact, since you don't even have values that you can meaningfully apply the function
strtok()
on, it is the wrong function anyway, no matter what your intention was!
Apparently you do not know what a class is for either, much less how to use inheritance. I suggest that you completely forget classes for now and start learning some basics of C before you delve into OOP. Before you object, consider this: the basic meaning of
class B : public C
is that 'B'
is a 'C'. or in other words, 'C' is a more general form of 'B', or 'B' is a special case of 'C'. With that in mind, look at this line from your code and tell me what it means:
class area:public rectangle,public triangle
From your code I can see that you wish to calculate and print areas of a rectangle and triangle, given a few measures that you provide from an input text file. Obviously you also intend to calculate some volume, but there is no code existant for that and no indication as to what shape of object you want to calculate the volume of.
Starting at the input, you are using ifstream to read some values. That is fine, but you seem to be missing the power of this class: instead of reading these values into char arrays, you could just as well directly read the float (or double or int) values that you actually want! That way you don't need to take care of the string-to-value conversion at all! In other word you don't need that converter class, ifstream already does it for you:
int main() {
float a, b, c;
ifstream mit("inp.txt");
mit >> a >> b >> c;
Then you define your shapes: triangles and rectangles so far, using these values. Since these values don't fully define general objects of the type rectangle or triangle however, the question is whether your point really is to define these shapes, or rather their geometrical properties. Apparently all you want is their area (for now at least), so just define two functions:
float triangle_area(float width, float height) {
return width * height / 2.0;
}
float rectangle_area(float width, float height) {
return width * height;
}
That is about all you need, as far as the current functionality of your code is concerned.