-
Classes
O.K. We had to create a program that would add, subtract, multiply and dvide fractions. I created a program that will do this. The only problem is that the program has to use classes. I am not sure how to do this. I read over the part here on the website and I read over my book and notes and just dont understand it. I have attached my program and if anyone could give me some ideas on how to transform it into a program that uses classes I would greatly appreciate it. Thanks a lot.
-
O.k. So i forgot to attach what I have so here it is.
-
:confused:
if you dont mind me asking what school do you go to? My class is doing that same type of program.....
what you need to do is make a header file to declare your class, class functions (+ * /) and private varables (numerator, denominator) the you need your cpp file for your class functions and then finaly your driver program (with int main())
hope this helps
-Skeptic
-
I go to Western Michigan. Are you in CS 104?
-
Although it's a good idea to declare and define classes in separate files, it's not mandatory. You can put it all in one file. With MSVC 6 class templates, at least, 3 different files won't compile a/o link.