As you know, computers can not operate on rational numbers and C++ does not have a type to store and manipulate rational numbers. You are asked to write a complete “Rational” class which can store, manipulate and use rational numbers in mathematical operations.
Rational number are the numbers of the form of a/b, where a and b are integer number such that b!=0. Zero can be denoted by 0/1.
Your class should have;
all constructors (default, and parametrized(with one parameter, and with two parameter)
copy constructor (memberwise initialization)
all getter and setter functions
assignment operator
arithmetic operators ( addition(+), subtraction(-), multiplication(*), division(/) ) as friend functions,
compound assignment operators ( += , -= , *=, and /= ) as member functions
relational operators ( less than(=) ) as friend functions
input and output operator ( extraction())
To test your class, write a main application which creates two 3x3 rational number two dimensional arrays(matrix). Populate matrix content such that;
First matrix content must be populated by (i+1)/(j+1)*2
Second matrix is populated with the formula (i*j+1)/(i*j]1*2)
multiply these two matrix to create the third one. Output the matrix contens in an appropriate way.
Your class shoud work with the following main also;
int main()
else
cout
Acil bir c++ odevim var cuzi miktarda ucret verebilirim!
Android & IOS Uygulama Geliştirme0 Mesaj
●20 Görüntüleme
- ReadBull.net
- Programlama ve Yazılım
- Android & IOS Uygulama Geliştirme
- Acil bir c++ odevim var cuzi miktarda ucret verebilirim!