Fraction functions

Hello,

I am a beginner in C++ and need some help with some functions..

Write a function of shortening fraction.
Write functions to add, subtract, multiply and divide of two fractions.
In the main program you need to display an example of use.
Note: the denominator of the fraction cannot be set to 0.


The help would be really appreciated.
What do you have so far?
// Datoteka: N14.cpp
// Funkcije za krajsanje ulomka, za sestevanje, odstevanje, mnozenje in deljenje ulomkov

#include <iostream>

using namespace std;

double mnozenjeUlomkov (double a, double b)
{ double produkt;
produkt = a * b;

return produkt;
}

int main()
{
double a, b, produkt;
cout << "Vpisi ulomek a in ulomek b:" << endl;
cin >> a >> b;
cout << "Produkt ulomkov:" << mnozenjeUlomkov(a, b) << endl;
return 0;

}


This is for multiplying fractions..
Last edited on
Topic archived. No new replies allowed.