### Need help with classes

hey guys so i had an assignment where i had to write a program in a class. I didn't understand it so i turned it in using functions. I have a test coming up and half of it will be on classes so i have to understand it. Heres my code was wondering if anyone could guide me in how i would put it in a class. Is it still possible or do i have to start all over? Any help is appreciated thank you

 ``123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112`` ``````# include using namespace std; class Fraction{ public: void sum(int a, int b, int c, int d, int& numerator, int& denominator) (); void mult(int a, int b, int c, int d, int& numerator, int& denominator) (); private: int num1,num2,num3,num4; // ints to hold values of numerator and denominators int numerator,denominator; // multiplied or added up fraction char again='y'; }; // fraction sum function void sum(int a, int b, int c, int d, int& numerator, int& denominator) { int array[]={2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101}; // array filled with primes numerator = (a * d) + ( b * c); denominator = b * d; cout << "The addition of your fractions is: " <> num1; cout << "Enter denominator of 1st fraction: "; cin >> num2; // if user enters 0 it prompts to enter number !=0 while(num2==0){ cout << "Denominator cannot be 0. Enter a new number: "; cin >> num2; } cout << "Enter numerator of 2nd fraction: "; cin >> num3; cout << "Enter denominator of 2nd fraction: "; cin >> num4; while(num4==0){ cout << "Denominator cannot be 0. Enter a new number: "; cin >> num2; } // call functions for addition and subtraction sum(num1,num2,num3,num4,numerator,denominator); mult(num1,num2,num3,num4,numerator,denominator); cout << " Would you like to go again (Y or N): "; cin >> again; } return 0; } ``````
Topic archived. No new replies allowed.