hello,help me plz Create a class called rational functions to perform arithmetic
ID: 3644108 • Letter: H
Question
hello,help me plzCreate a class called rational functions to perform arithmetic on fractions
Then write a program that uses this class
Class data members are:
If the denominator
And class member functions are:
Addition, subtraction, multiplication and division of two fractions
Print an integer number deficit deficit
Numbers printed as decimal fractions
(turbo c++ - version3 - compiler:borland )
THANKS
mahdi k
You gave one of the following programs:(Not avail)
#include "stdafx.h"
#include <iostream>
#include <conio.h>
using namespace std;
void main()
{
int a,b;
cout<<"Enter first No:";
cin>>a;
cout<<"Enter second No:";
cin>>b;
cout<<"The sum is:"<<(a+b)<<endl;
cout<<"The product is:"<<(a*b)<<endl;
cout<<"The subtraction is:"<<(a-b)<<endl;
cout<<"The division is:"<<(a/b)<<endl;
getch();
}
errors:
1-unable to open file"stdafx"
2-syntax error(using namespace)
help me plz.
Explanation / Answer
#include #include class fraction { private: int n; int d; public: fraction(){} fraction(int n1,int d1) { n = n1; if(d1==0) { coutRelated Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.