Thread: Classes

  1. #1
    Registered User
    Join Date
    Oct 2001
    Posts
    30

    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.

  2. #2
    Registered User
    Join Date
    Oct 2001
    Posts
    30
    O.k. So i forgot to attach what I have so here it is.

  3. #3
    Registered User
    Join Date
    Nov 2001
    Posts
    24

    Lightbulb



    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

  4. #4
    Registered User
    Join Date
    Oct 2001
    Posts
    30
    I go to Western Michigan. Are you in CS 104?

  5. #5
    Registered User
    Join Date
    Aug 2001
    Posts
    154
    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.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Can you Initialize all classes once with New?
    By peacerosetx in forum C++ Programming
    Replies: 12
    Last Post: 07-02-2008, 10:47 AM
  2. Multiple Inheritance - Size of Classes?
    By Zeusbwr in forum C++ Programming
    Replies: 10
    Last Post: 11-26-2004, 09:04 AM
  3. im extreamly new help
    By rigo305 in forum C++ Programming
    Replies: 27
    Last Post: 04-23-2004, 11:22 PM
  4. Exporting VC++ classes for use with VB
    By Helix in forum Windows Programming
    Replies: 2
    Last Post: 12-29-2003, 05:38 PM
  5. Prime Number Generator... Help !?!!
    By Halo in forum C++ Programming
    Replies: 9
    Last Post: 10-20-2003, 07:26 PM