Code:
#include "stdafx.h"
#include <iostream>
using namespace std;
int divide()
{
int one4,two4,three4,four4;
int e4,f4;
int x;
cout<<"Input the nominator and denominator of a fraction separated by spaces :"<<endl;
cin>>one4;
cin>>two4;
cout<<"Input the nominator and denominator of a fraction separated by spaces :"<<endl;
cout<<"Input instruction/_" << endl;
e4 = one4*four4;
f4 = two4*three4;
x=gcd(e4,f4);
simplify(e4,f4,x);
cout<<x<<endl;
cout<<"("<< one4 << "/"<< two4 <<") / ("<< three4 <<"/"<< four4 <<") = " << e4 << "/" << f4;
cout << "\n";
return 0;
}
int multiply()
{
int one3,two3,three3,four3;
int e3,f3,p;
cout<<"Input the numerator and denominator of a fraction separated by spaces :"<<endl;
cin>>one3;
cin>>two3;
cout<<"Input the numerator and denominator of a fraction separated by spaces :"<<endl;
cin>>three3;
cin>>four3;
cout<<"Input instruction*_" << endl;
e3 = one3*three3;
f3 = two3*four3;
p=gcd(e3,f3); here is telling me(1>fdgfd.cpp.cpp(24): error C3861: 'gcd': identifier not found
1>fdgfd.cpp.cpp(25): error C3861: 'simplify': identifier not found
1>fdgfd.cpp.cpp(48): error C3861: 'gcd': identifier not found
1>fdgfd.cpp.cpp(49): error C3861: 'simplify': identifier not found
1>
simplify(e3,f3,p);
cout<<"("<< one3 << "/"<< two3 <<") * ("<< three3 <<"/"<< four3 <<") = " << e3 << "/" << f3;
cout << "\n";
return 0;
}
void simplify(int x2 , int y2 ,int gcd )
{
int a;
int b;
a= x2/gcd;
b= y2/gcd;
return (a,b);
}
int gcd(int x2, int y2)
{
int i;
int gcd2;
for (i=1; i<=x2; i++)
{
if((x2%i==0) && (y2%i==0))
gcd2 = i;
}
return gcd2;
}
void main()
{
multiply();
divide();
system ("PAUSE");
}
MAybe now somebody can help me ....