SlideShare a Scribd company logo
1 of 13
Download to read offline
Hey, looking to do the following with this programFill in the multiplication, and division ,
modulus, <=, >=, -, * With division being a friend function
1.) Have Division be a friend function
2.) Have multiplication, divison, and modulus <=, >=, -, * with the program filling them.
I tried doing something along the lines of this....
friend money operator <<(const money& lhs);
friend money operator >>( const money& rhs);
but I'm note quite sure if this is correct. Any help will be helpful. I don't want just answers, I
want good explanations so I can understand this material.
Whole code posted below.
#include
using namespace std;
class money
{
private:
int dollars;
int cents;
public:
money():dollars(0), cents(0){}
money(int dollars_in):dollars(dollars_in), cents(0){}
money(int dollars_in, int cents_in):dollars(dollars_in), cents(cents_in){}
int get_dollars() const;
int get_cents() const;
void set_dollars(int d_in);
void set_cents(int c_in);
money operator ++();
money operator ++(int x);
money operator +(const money& rhs);
money operator -();
friend const money& operator +(const money& lhs, const money& rhs);
money operator --();
money operator --(int x);
bool operator <=();
bool operator >=();
};
// do this as a general function
money operator *(const money& lhs, const money& rhs)
{
return money(0, 0);
}
// do this as a friend function
money operator -(const money& lhs, const money& rhs)
{
return money(0, 0);
}
money money::operator -()
{
return money(get_dollars(), get_cents());
}
money money::operator ++(int blah)
{
int tmp_d = dollars;
int tmp_c = cents;
dollars++;
return money(tmp_d, tmp_c);
}
money money::operator ++()
{
int tmp_d = dollars;
tmp_d += 1;
return money(dollars, cents);
}
int money::get_dollars() const
{
return dollars;
}
int money::get_cents() const
{
return cents;
}
void money::set_dollars(int d_in)
{
dollars = d_in;
}
void money::set_cents(int c_in)
{
cents = c_in;
}
ostream& operator <<(ostream& os, const money& rhs)
{
os << "$" << rhs.get_dollars() << ".";
if(rhs.get_cents() < 10)
{
os << "0";
}
os << rhs.get_cents();
return os;
}
money money::operator +(const money& rhs)
{
int tmp_d = 0;
int tmp_c = 0;
int hold_c = 0;
int hold_d = 0;
tmp_d = get_dollars() + rhs.get_dollars();
tmp_c = get_cents() + rhs.get_cents();
if(tmp_c > 99)
{
hold_c = tmp_c % 100;
cout << "hold_c = " << hold_c << endl;
hold_d = tmp_c / 100;
cout << "hold_d = " << hold_d << endl;
for(int i = 0; i < hold_d; i++)
{
tmp_d++;
}
tmp_c = hold_c;
}
return money(tmp_d, tmp_c);
}
const money& operator +(const money& lhs, const money& rhs)
{
int tmp_d = 0;
int tmp_c = 0;
int hold_c = 0;
int hold_d = 0;
tmp_d = lhs.dollars + rhs.dollars;
tmp_c = lhs.cents + rhs.cents;
if(tmp_c > 99)
{
hold_c = tmp_c % 100;
cout << "hold_c = " << hold_c << endl;
hold_d = tmp_c / 100;
cout << "hold_d = " << hold_d << endl;
for(int i = 0; i < hold_d; i++)
{
tmp_d++;
}
tmp_c = hold_c;
}
return money(tmp_d, tmp_c);
}
bool operator ==(const money& lhs, const money& rhs)
{
return ((lhs.get_dollars() == rhs.get_dollars()) && (lhs.get_cents() == rhs.get_cents()));
}
int main()
{
money m1;
money m2(100, 99);
money m3(250, 5);
cout << "m1 = " << m1 << endl;
cout << "m2 = " << m2 << endl;
cout << "m3 = " << m3 << endl;
m1 = m2 + m3;
cout << "m1 = " << m1 << endl;
m1 = m1 + 200;
cout << "m1 + 200 " << endl;
cout << "m1 = " << m1 << endl;
cout << "m2 + m3" << endl;
cout << "m1 = " << m1 << endl;
cout << "m2 == m1 " << endl;
cout << "m1 = " << m1 << endl;
cout << "m2 = " << m2 << endl;
cout << (m2 == m1) << endl;
m1 = money();
m2 = money();
cout << "m1 = " << m1 << endl;
cout << "m2 = " << m2 << endl;
cout << (m2 == m1) << endl;
cout << "++m1 " << endl;
++m1;
cout << "m1 = " << m1 << endl;
cout << "m1++" << endl;
cout << m1++ << endl;
cout << "m1 = " << m1 << endl;
cout << "-m1 = " << -m1 << endl;
m2 = money(1, 0);
m3 = money(2, 0);
money tm;
tm = (m3 + -m2);
cout << "m3 = " << m3 << endl;
cout << "m2 = " << m2 << endl;
cout << "(m3 + -m2) = " << tm << endl;
m1 = money;
m2 = money(101, 78);
m3 = money(202, 10);
m2 <= m3?cout << "m2 <= m3" << endl; : cout << "m2 is not <= m3" << endl;
m2 >= m3?cout << "m2 >= m3" << endl; : cout << "m2 is not >= m3" << endl;
m1 = m3 * m2;
cout << "m3 * m2 = " << m1 << endl;
m1 = m3 - m2;
cout << "m3 - m2 = " << m1 << endl;
return 0;
}
Solution
#include
using namespace std;
class money
{
private:
int dollars;
int cents;
public:
money():dollars(0), cents(0){}
money(int dollars_in):dollars(dollars_in), cents(0){}
money(int dollars_in, int cents_in):dollars(dollars_in), cents(cents_in){}
int get_dollars() const;
int get_cents() const;
void set_dollars(int d_in);
void set_cents(int c_in);
money operator ++();
money operator ++(int x);
money operator +(const money& rhs);
money operator *(const money& rhs);
friend money operator -(const money& lhs, const money& rhs);
friend money operator /(const money& lhs,const money& rhs);
money operator -();
friend const money& operator +(const money& lhs, const money& rhs);
money operator --();
money operator --(int x);
bool operator ==(const money& n);
bool operator <=(money n);
bool operator >=(money m);
};
// do this as a general function
money money::operator *(const money& rhs)
{
int d= dollars*rhs.get_dollars();
int c= cents*rhs.get_cents();
int c1 = c/100;
d=d+c1;
int c2=c%100;
return money(d, c2);
}
// friend function
money operator -(const money& lhs, const money& rhs)
{
int n = lhs.get_dollars()-rhs.get_dollars();
int c= lhs.get_cents()-rhs.get_cents();
if(c<0)
{
n--;
c=c*-1;
}
return money(n,c);
}
// friend function division
money operator /(const money& lhs, const money& rhs)
{
int n = lhs.get_dollars()/rhs.get_dollars();
int d= lhs.get_dollars()% rhs.get_dollars();
int c= lhs.get_cents()/rhs.get_cents();
c=c+d;
return money(n,c);
}
money money::operator -()
{
return money(-get_dollars(), -get_cents());
}
money money::operator ++(int blah)
{
this->dollars=this->dollars+blah;
return money(dollars,cents);
}
money money::operator ++()
{
dollars++;
return money(dollars,cents);
}
int money::get_dollars() const
{
return dollars;
}
int money::get_cents() const
{
return cents;
}
void money::set_dollars(int d_in)
{
dollars = d_in;
}
void money::set_cents(int c_in)
{
cents = c_in;
}
ostream& operator <<(ostream& os, const money& rhs)
{
os << "$" << rhs.get_dollars() << ".";
if(rhs.get_cents() < 10)
{
os << "0";
}
os << rhs.get_cents();
return os;
}
money money::operator +(const money& rhs)
{
int tmp_d = 0;
int tmp_c = 0;
int hold_c = 0;
int hold_d = 0;
tmp_d = get_dollars() + rhs.get_dollars();
tmp_c = get_cents() + rhs.get_cents();
if(tmp_c > 99)
{
hold_c = tmp_c % 100;
cout << "hold_c = " << hold_c << endl;
hold_d = tmp_c / 100;
cout << "hold_d = " << hold_d << endl;
for(int i = 0; i < hold_d; i++)
{
tmp_d++;
}
tmp_c = hold_c;
}
return money(tmp_d, tmp_c);
}
const money& operator +(const money& lhs, const money& rhs)
{
int tmp_d = 0;
int tmp_c = 0;
int hold_c = 0;
int hold_d = 0;
tmp_d = lhs.dollars + rhs.dollars;
tmp_c = lhs.cents + rhs.cents;
if(tmp_c > 99)
{
hold_c = tmp_c % 100;
cout << "hold_c = " << hold_c << endl;
hold_d = tmp_c / 100;
cout << "hold_d = " << hold_d << endl;
for(int i = 0; i < hold_d; i++)
{
tmp_d++;
}
tmp_c = hold_c;
}
return money(tmp_d, tmp_c);
}
bool money::operator ==(const money& rhs)
{
return ((get_dollars() == rhs.get_dollars()) && (get_cents() == rhs.get_cents()));
}
bool money::operator <=(money m)
{
if(dollars< m.dollars)
return true;
else if(dollars==m.dollars)
{
if(cents < m.cents)
return true;
else if(cents > m.cents) return false;
}
else return false;
}
bool money::operator >=(money m)
{
if(dollars > m.dollars)
return true;
else if(dollars==m.dollars)
{
if(cents > m.cents)
return true;
else if(cents < m.cents) return false;
}
else return false;
}
int main()
{
money m1;
money m2(100, 99);
money m3(250, 5);
cout << "m1 = " << m1 << endl;
cout << "m2 = " << m2 << endl;
cout << "m3 = " << m3 << endl;
m1 = m2 + m3;
cout << "m1 = " << m1 << endl;
m1 = m1 + 200;
cout << "m1 + 200 " << endl;
cout << "m1 = " << m1 << endl;
cout << "m2 + m3" << endl;
cout << "m1 = " << m1 << endl;
cout << "m2 == m1 " << endl;
cout << "m1 = " << m1 << endl;
cout << "m2 = " << m2 << endl;
cout << (m2 == m1) << endl;
m1 = money();
m2 = money();
cout << "m1 = " << m1 << endl;
cout << "m2 = " << m2 << endl;
cout << (m2 == m1) << endl;
cout << "++m1 " << endl;
++m1;
cout << "m1 = " << m1 << endl;
cout << "m1++" << endl;
cout << m1++ << endl;
cout << "m1 = " << m1 << endl;
cout << "-m1 = " << -m1 << endl;
m2 = money(1, 0);
m3 = money(2, 0);
money tm;
tm = (m3 + -m2);
cout << "m3 = " << m3 << endl;
cout << "m2 = " << m2 << endl;
cout << "(m3 + -m2) = " << tm << endl;
m1 = money();
m2 = money(101, 78);
m3 = money(202, 10);
if(m2 <= m3)
cout << "m2 <= m3" << endl;
else cout << "m2 is not <= m3" << endl;
if(m2 >= m3)
cout << "m2 >= m3" << endl;
else cout << "m2 is not >= m3" << endl;
m1 = m3 * m2;
cout << "m3 * m2 = " << m1 << endl;
m1 = m3 - m2;
cout << "m3 - m2 = " << m1 << endl;
return 0;
}

More Related Content

Similar to Hey, looking to do the following with this programFill in the multip.pdf

#include Status.hnamespace sdds{StatusStatus(c
#include Status.hnamespace sdds{StatusStatus(c#include Status.hnamespace sdds{StatusStatus(c
#include Status.hnamespace sdds{StatusStatus(cSilvaGraf83
 
EJERCICIOS DE BORLAND C++ 2DA PARTE.docx
EJERCICIOS DE BORLAND C++ 2DA PARTE.docxEJERCICIOS DE BORLAND C++ 2DA PARTE.docx
EJERCICIOS DE BORLAND C++ 2DA PARTE.docxleovasquez17
 
EJERCICIOS DE BORLAND C++ 2DA PARTE.docx
EJERCICIOS DE BORLAND C++ 2DA PARTE.docxEJERCICIOS DE BORLAND C++ 2DA PARTE.docx
EJERCICIOS DE BORLAND C++ 2DA PARTE.docxleovasquez17
 
Bank management system project in c++ with graphics
Bank management system project in c++ with graphicsBank management system project in c++ with graphics
Bank management system project in c++ with graphicsVtech Academy of Computers
 
need help with this code#include #include #include #includ.docx
need help with this code#include #include #include #includ.docxneed help with this code#include #include #include #includ.docx
need help with this code#include #include #include #includ.docxTanaMaeskm
 
I keep on get a redefinition error and an undefined error.Customer.pdf
I keep on get a redefinition error and an undefined error.Customer.pdfI keep on get a redefinition error and an undefined error.Customer.pdf
I keep on get a redefinition error and an undefined error.Customer.pdfherminaherman
 
Utility bill project.doc
Utility bill project.docUtility bill project.doc
Utility bill project.docJeremy Forczyk
 
Please use the code below and make it operate as one program- Notating.pdf
Please use the code below and make it operate as one program- Notating.pdfPlease use the code below and make it operate as one program- Notating.pdf
Please use the code below and make it operate as one program- Notating.pdfseoagam1
 
This what Im suppose to do and this is what I have so far.In thi.pdf
This what Im suppose to do and this is what I have so far.In thi.pdfThis what Im suppose to do and this is what I have so far.In thi.pdf
This what Im suppose to do and this is what I have so far.In thi.pdfkavithaarp
 
C101-PracticeProblems.pdf
C101-PracticeProblems.pdfC101-PracticeProblems.pdf
C101-PracticeProblems.pdfT17Rockstar
 
c++ Lecture 2
c++ Lecture 2c++ Lecture 2
c++ Lecture 2sajidpk92
 
Lab Assignment #6, part 3 Time ConversionProgram Name lab.docx
Lab Assignment #6, part 3 Time ConversionProgram Name lab.docxLab Assignment #6, part 3 Time ConversionProgram Name lab.docx
Lab Assignment #6, part 3 Time ConversionProgram Name lab.docxsmile790243
 
Assignment_URI_Code_Solution_Roll_2010052 (1).pdf
Assignment_URI_Code_Solution_Roll_2010052 (1).pdfAssignment_URI_Code_Solution_Roll_2010052 (1).pdf
Assignment_URI_Code_Solution_Roll_2010052 (1).pdfSamiulHaque58
 
Chainer-Compiler 動かしてみた
Chainer-Compiler 動かしてみたChainer-Compiler 動かしてみた
Chainer-Compiler 動かしてみたAkira Maruoka
 

Similar to Hey, looking to do the following with this programFill in the multip.pdf (20)

#include Status.hnamespace sdds{StatusStatus(c
#include Status.hnamespace sdds{StatusStatus(c#include Status.hnamespace sdds{StatusStatus(c
#include Status.hnamespace sdds{StatusStatus(c
 
EJERCICIOS DE BORLAND C++ 2DA PARTE.docx
EJERCICIOS DE BORLAND C++ 2DA PARTE.docxEJERCICIOS DE BORLAND C++ 2DA PARTE.docx
EJERCICIOS DE BORLAND C++ 2DA PARTE.docx
 
EJERCICIOS DE BORLAND C++ 2DA PARTE.docx
EJERCICIOS DE BORLAND C++ 2DA PARTE.docxEJERCICIOS DE BORLAND C++ 2DA PARTE.docx
EJERCICIOS DE BORLAND C++ 2DA PARTE.docx
 
CPP Homework Help
CPP Homework HelpCPP Homework Help
CPP Homework Help
 
Bank management system project in c++ with graphics
Bank management system project in c++ with graphicsBank management system project in c++ with graphics
Bank management system project in c++ with graphics
 
need help with this code#include #include #include #includ.docx
need help with this code#include #include #include #includ.docxneed help with this code#include #include #include #includ.docx
need help with this code#include #include #include #includ.docx
 
Ch4
Ch4Ch4
Ch4
 
I keep on get a redefinition error and an undefined error.Customer.pdf
I keep on get a redefinition error and an undefined error.Customer.pdfI keep on get a redefinition error and an undefined error.Customer.pdf
I keep on get a redefinition error and an undefined error.Customer.pdf
 
Utility bill project.doc
Utility bill project.docUtility bill project.doc
Utility bill project.doc
 
distill
distilldistill
distill
 
project
projectproject
project
 
Please use the code below and make it operate as one program- Notating.pdf
Please use the code below and make it operate as one program- Notating.pdfPlease use the code below and make it operate as one program- Notating.pdf
Please use the code below and make it operate as one program- Notating.pdf
 
This what Im suppose to do and this is what I have so far.In thi.pdf
This what Im suppose to do and this is what I have so far.In thi.pdfThis what Im suppose to do and this is what I have so far.In thi.pdf
This what Im suppose to do and this is what I have so far.In thi.pdf
 
C++ TUTORIAL 3
C++ TUTORIAL 3C++ TUTORIAL 3
C++ TUTORIAL 3
 
C101-PracticeProblems.pdf
C101-PracticeProblems.pdfC101-PracticeProblems.pdf
C101-PracticeProblems.pdf
 
lesson 2.pptx
lesson 2.pptxlesson 2.pptx
lesson 2.pptx
 
c++ Lecture 2
c++ Lecture 2c++ Lecture 2
c++ Lecture 2
 
Lab Assignment #6, part 3 Time ConversionProgram Name lab.docx
Lab Assignment #6, part 3 Time ConversionProgram Name lab.docxLab Assignment #6, part 3 Time ConversionProgram Name lab.docx
Lab Assignment #6, part 3 Time ConversionProgram Name lab.docx
 
Assignment_URI_Code_Solution_Roll_2010052 (1).pdf
Assignment_URI_Code_Solution_Roll_2010052 (1).pdfAssignment_URI_Code_Solution_Roll_2010052 (1).pdf
Assignment_URI_Code_Solution_Roll_2010052 (1).pdf
 
Chainer-Compiler 動かしてみた
Chainer-Compiler 動かしてみたChainer-Compiler 動かしてみた
Chainer-Compiler 動かしてみた
 

More from rupeshmehta151

Is Jeff M related to the H family SolutionYes, as we can see .pdf
Is Jeff M related to the H family  SolutionYes, as we can see .pdfIs Jeff M related to the H family  SolutionYes, as we can see .pdf
Is Jeff M related to the H family SolutionYes, as we can see .pdfrupeshmehta151
 
IV. Seedling Growth37. What is epigeal seedling growth38. What .pdf
IV. Seedling Growth37. What is epigeal seedling growth38. What .pdfIV. Seedling Growth37. What is epigeal seedling growth38. What .pdf
IV. Seedling Growth37. What is epigeal seedling growth38. What .pdfrupeshmehta151
 
In one sentence state the main result of the graph (note the filled .pdf
In one sentence state the main result of the graph (note the filled .pdfIn one sentence state the main result of the graph (note the filled .pdf
In one sentence state the main result of the graph (note the filled .pdfrupeshmehta151
 
graph theory Let W_n be the wheel graph on n + 1 vertices (that is, .pdf
graph theory Let W_n be the wheel graph on n + 1 vertices (that is, .pdfgraph theory Let W_n be the wheel graph on n + 1 vertices (that is, .pdf
graph theory Let W_n be the wheel graph on n + 1 vertices (that is, .pdfrupeshmehta151
 
Crime is said to be intra-racial. What is meant by this Do you beli.pdf
Crime is said to be intra-racial. What is meant by this Do you beli.pdfCrime is said to be intra-racial. What is meant by this Do you beli.pdf
Crime is said to be intra-racial. What is meant by this Do you beli.pdfrupeshmehta151
 
About 98 of the E. coli genome codes for proteins, yet mRNA, the t.pdf
About 98  of the E. coli genome codes for proteins, yet mRNA, the t.pdfAbout 98  of the E. coli genome codes for proteins, yet mRNA, the t.pdf
About 98 of the E. coli genome codes for proteins, yet mRNA, the t.pdfrupeshmehta151
 
A company had net assets as at 1 January 2016 of £123m. The net prof.pdf
A company had net assets as at 1 January 2016 of £123m. The net prof.pdfA company had net assets as at 1 January 2016 of £123m. The net prof.pdf
A company had net assets as at 1 January 2016 of £123m. The net prof.pdfrupeshmehta151
 
Amino acids are joined together to make proteins in what kind of .pdf
Amino acids are joined together to make proteins in what kind of .pdfAmino acids are joined together to make proteins in what kind of .pdf
Amino acids are joined together to make proteins in what kind of .pdfrupeshmehta151
 
7. Mendels Principle of Segregation states that the alleles of a ge.pdf
7. Mendels Principle of Segregation states that the alleles of a ge.pdf7. Mendels Principle of Segregation states that the alleles of a ge.pdf
7. Mendels Principle of Segregation states that the alleles of a ge.pdfrupeshmehta151
 
4. Based on our sample data, can we conclude that males and females .pdf
4. Based on our sample data, can we conclude that males and females .pdf4. Based on our sample data, can we conclude that males and females .pdf
4. Based on our sample data, can we conclude that males and females .pdfrupeshmehta151
 
An unassuming single-celled organism called Toxoplasma gondii is one.pdf
An unassuming single-celled organism called Toxoplasma gondii is one.pdfAn unassuming single-celled organism called Toxoplasma gondii is one.pdf
An unassuming single-celled organism called Toxoplasma gondii is one.pdfrupeshmehta151
 
A boy with Klinefelter Syndrome (XXY) has colorblindness, which is a.pdf
A boy with Klinefelter Syndrome (XXY) has colorblindness, which is a.pdfA boy with Klinefelter Syndrome (XXY) has colorblindness, which is a.pdf
A boy with Klinefelter Syndrome (XXY) has colorblindness, which is a.pdfrupeshmehta151
 
What is unrefined and refined foodsSolutionAnswerRefined f.pdf
What is unrefined and refined foodsSolutionAnswerRefined f.pdfWhat is unrefined and refined foodsSolutionAnswerRefined f.pdf
What is unrefined and refined foodsSolutionAnswerRefined f.pdfrupeshmehta151
 
What is the function of CFTR (details are important) (5 points).pdf
What is the function of CFTR (details are important) (5 points).pdfWhat is the function of CFTR (details are important) (5 points).pdf
What is the function of CFTR (details are important) (5 points).pdfrupeshmehta151
 
What are transgenic animalsSolutionTransgenic animals are tho.pdf
What are transgenic animalsSolutionTransgenic animals are tho.pdfWhat are transgenic animalsSolutionTransgenic animals are tho.pdf
What are transgenic animalsSolutionTransgenic animals are tho.pdfrupeshmehta151
 
Urea concentration in the phospholipid bilayer is 0.02mM, 3.65mM in .pdf
Urea concentration in the phospholipid bilayer is 0.02mM, 3.65mM in .pdfUrea concentration in the phospholipid bilayer is 0.02mM, 3.65mM in .pdf
Urea concentration in the phospholipid bilayer is 0.02mM, 3.65mM in .pdfrupeshmehta151
 
A diploid organism has a somatic chromosome number of 16. The centro.pdf
A diploid organism has a somatic chromosome number of 16. The centro.pdfA diploid organism has a somatic chromosome number of 16. The centro.pdf
A diploid organism has a somatic chromosome number of 16. The centro.pdfrupeshmehta151
 
the heights of a sample of 10 fatherson pairs of subjects were meas.pdf
the heights of a sample of 10 fatherson pairs of subjects were meas.pdfthe heights of a sample of 10 fatherson pairs of subjects were meas.pdf
the heights of a sample of 10 fatherson pairs of subjects were meas.pdfrupeshmehta151
 
Should the FCC regulate the media, and if yes, how far should you go.pdf
Should the FCC regulate the media, and if yes, how far should you go.pdfShould the FCC regulate the media, and if yes, how far should you go.pdf
Should the FCC regulate the media, and if yes, how far should you go.pdfrupeshmehta151
 
Read carefully and follow exactly Java You are to write a Breakou.pdf
Read carefully and follow exactly Java You are to write a Breakou.pdfRead carefully and follow exactly Java You are to write a Breakou.pdf
Read carefully and follow exactly Java You are to write a Breakou.pdfrupeshmehta151
 

More from rupeshmehta151 (20)

Is Jeff M related to the H family SolutionYes, as we can see .pdf
Is Jeff M related to the H family  SolutionYes, as we can see .pdfIs Jeff M related to the H family  SolutionYes, as we can see .pdf
Is Jeff M related to the H family SolutionYes, as we can see .pdf
 
IV. Seedling Growth37. What is epigeal seedling growth38. What .pdf
IV. Seedling Growth37. What is epigeal seedling growth38. What .pdfIV. Seedling Growth37. What is epigeal seedling growth38. What .pdf
IV. Seedling Growth37. What is epigeal seedling growth38. What .pdf
 
In one sentence state the main result of the graph (note the filled .pdf
In one sentence state the main result of the graph (note the filled .pdfIn one sentence state the main result of the graph (note the filled .pdf
In one sentence state the main result of the graph (note the filled .pdf
 
graph theory Let W_n be the wheel graph on n + 1 vertices (that is, .pdf
graph theory Let W_n be the wheel graph on n + 1 vertices (that is, .pdfgraph theory Let W_n be the wheel graph on n + 1 vertices (that is, .pdf
graph theory Let W_n be the wheel graph on n + 1 vertices (that is, .pdf
 
Crime is said to be intra-racial. What is meant by this Do you beli.pdf
Crime is said to be intra-racial. What is meant by this Do you beli.pdfCrime is said to be intra-racial. What is meant by this Do you beli.pdf
Crime is said to be intra-racial. What is meant by this Do you beli.pdf
 
About 98 of the E. coli genome codes for proteins, yet mRNA, the t.pdf
About 98  of the E. coli genome codes for proteins, yet mRNA, the t.pdfAbout 98  of the E. coli genome codes for proteins, yet mRNA, the t.pdf
About 98 of the E. coli genome codes for proteins, yet mRNA, the t.pdf
 
A company had net assets as at 1 January 2016 of £123m. The net prof.pdf
A company had net assets as at 1 January 2016 of £123m. The net prof.pdfA company had net assets as at 1 January 2016 of £123m. The net prof.pdf
A company had net assets as at 1 January 2016 of £123m. The net prof.pdf
 
Amino acids are joined together to make proteins in what kind of .pdf
Amino acids are joined together to make proteins in what kind of .pdfAmino acids are joined together to make proteins in what kind of .pdf
Amino acids are joined together to make proteins in what kind of .pdf
 
7. Mendels Principle of Segregation states that the alleles of a ge.pdf
7. Mendels Principle of Segregation states that the alleles of a ge.pdf7. Mendels Principle of Segregation states that the alleles of a ge.pdf
7. Mendels Principle of Segregation states that the alleles of a ge.pdf
 
4. Based on our sample data, can we conclude that males and females .pdf
4. Based on our sample data, can we conclude that males and females .pdf4. Based on our sample data, can we conclude that males and females .pdf
4. Based on our sample data, can we conclude that males and females .pdf
 
An unassuming single-celled organism called Toxoplasma gondii is one.pdf
An unassuming single-celled organism called Toxoplasma gondii is one.pdfAn unassuming single-celled organism called Toxoplasma gondii is one.pdf
An unassuming single-celled organism called Toxoplasma gondii is one.pdf
 
A boy with Klinefelter Syndrome (XXY) has colorblindness, which is a.pdf
A boy with Klinefelter Syndrome (XXY) has colorblindness, which is a.pdfA boy with Klinefelter Syndrome (XXY) has colorblindness, which is a.pdf
A boy with Klinefelter Syndrome (XXY) has colorblindness, which is a.pdf
 
What is unrefined and refined foodsSolutionAnswerRefined f.pdf
What is unrefined and refined foodsSolutionAnswerRefined f.pdfWhat is unrefined and refined foodsSolutionAnswerRefined f.pdf
What is unrefined and refined foodsSolutionAnswerRefined f.pdf
 
What is the function of CFTR (details are important) (5 points).pdf
What is the function of CFTR (details are important) (5 points).pdfWhat is the function of CFTR (details are important) (5 points).pdf
What is the function of CFTR (details are important) (5 points).pdf
 
What are transgenic animalsSolutionTransgenic animals are tho.pdf
What are transgenic animalsSolutionTransgenic animals are tho.pdfWhat are transgenic animalsSolutionTransgenic animals are tho.pdf
What are transgenic animalsSolutionTransgenic animals are tho.pdf
 
Urea concentration in the phospholipid bilayer is 0.02mM, 3.65mM in .pdf
Urea concentration in the phospholipid bilayer is 0.02mM, 3.65mM in .pdfUrea concentration in the phospholipid bilayer is 0.02mM, 3.65mM in .pdf
Urea concentration in the phospholipid bilayer is 0.02mM, 3.65mM in .pdf
 
A diploid organism has a somatic chromosome number of 16. The centro.pdf
A diploid organism has a somatic chromosome number of 16. The centro.pdfA diploid organism has a somatic chromosome number of 16. The centro.pdf
A diploid organism has a somatic chromosome number of 16. The centro.pdf
 
the heights of a sample of 10 fatherson pairs of subjects were meas.pdf
the heights of a sample of 10 fatherson pairs of subjects were meas.pdfthe heights of a sample of 10 fatherson pairs of subjects were meas.pdf
the heights of a sample of 10 fatherson pairs of subjects were meas.pdf
 
Should the FCC regulate the media, and if yes, how far should you go.pdf
Should the FCC regulate the media, and if yes, how far should you go.pdfShould the FCC regulate the media, and if yes, how far should you go.pdf
Should the FCC regulate the media, and if yes, how far should you go.pdf
 
Read carefully and follow exactly Java You are to write a Breakou.pdf
Read carefully and follow exactly Java You are to write a Breakou.pdfRead carefully and follow exactly Java You are to write a Breakou.pdf
Read carefully and follow exactly Java You are to write a Breakou.pdf
 

Recently uploaded

Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...Marc Dusseiller Dusjagr
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionSafetyChain Software
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3JemimahLaneBuaron
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxOH TEIK BIN
 
PSYCHIATRIC History collection FORMAT.pptx
PSYCHIATRIC   History collection FORMAT.pptxPSYCHIATRIC   History collection FORMAT.pptx
PSYCHIATRIC History collection FORMAT.pptxPoojaSen20
 
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxContemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxRoyAbrique
 
Micromeritics - Fundamental and Derived Properties of Powders
Micromeritics - Fundamental and Derived Properties of PowdersMicromeritics - Fundamental and Derived Properties of Powders
Micromeritics - Fundamental and Derived Properties of PowdersChitralekhaTherkar
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxmanuelaromero2013
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAssociation for Project Management
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentInMediaRes1
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformChameera Dedduwage
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfchloefrazer622
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdfssuser54595a
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docxPoojaSen20
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 

Recently uploaded (20)

Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory Inspection
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptx
 
PSYCHIATRIC History collection FORMAT.pptx
PSYCHIATRIC   History collection FORMAT.pptxPSYCHIATRIC   History collection FORMAT.pptx
PSYCHIATRIC History collection FORMAT.pptx
 
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxContemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
 
Micromeritics - Fundamental and Derived Properties of Powders
Micromeritics - Fundamental and Derived Properties of PowdersMicromeritics - Fundamental and Derived Properties of Powders
Micromeritics - Fundamental and Derived Properties of Powders
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptx
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across Sectors
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media Component
 
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdf
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docx
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 

Hey, looking to do the following with this programFill in the multip.pdf

  • 1. Hey, looking to do the following with this programFill in the multiplication, and division , modulus, <=, >=, -, * With division being a friend function 1.) Have Division be a friend function 2.) Have multiplication, divison, and modulus <=, >=, -, * with the program filling them. I tried doing something along the lines of this.... friend money operator <<(const money& lhs); friend money operator >>( const money& rhs); but I'm note quite sure if this is correct. Any help will be helpful. I don't want just answers, I want good explanations so I can understand this material. Whole code posted below. #include using namespace std; class money { private: int dollars; int cents; public: money():dollars(0), cents(0){} money(int dollars_in):dollars(dollars_in), cents(0){} money(int dollars_in, int cents_in):dollars(dollars_in), cents(cents_in){} int get_dollars() const; int get_cents() const; void set_dollars(int d_in); void set_cents(int c_in); money operator ++(); money operator ++(int x); money operator +(const money& rhs); money operator -(); friend const money& operator +(const money& lhs, const money& rhs);
  • 2. money operator --(); money operator --(int x); bool operator <=(); bool operator >=(); }; // do this as a general function money operator *(const money& lhs, const money& rhs) { return money(0, 0); } // do this as a friend function money operator -(const money& lhs, const money& rhs) { return money(0, 0); } money money::operator -() { return money(get_dollars(), get_cents()); } money money::operator ++(int blah) { int tmp_d = dollars; int tmp_c = cents; dollars++; return money(tmp_d, tmp_c); } money money::operator ++() { int tmp_d = dollars; tmp_d += 1; return money(dollars, cents); } int money::get_dollars() const { return dollars;
  • 3. } int money::get_cents() const { return cents; } void money::set_dollars(int d_in) { dollars = d_in; } void money::set_cents(int c_in) { cents = c_in; } ostream& operator <<(ostream& os, const money& rhs) { os << "$" << rhs.get_dollars() << "."; if(rhs.get_cents() < 10) { os << "0"; } os << rhs.get_cents(); return os; } money money::operator +(const money& rhs) { int tmp_d = 0; int tmp_c = 0; int hold_c = 0; int hold_d = 0; tmp_d = get_dollars() + rhs.get_dollars(); tmp_c = get_cents() + rhs.get_cents(); if(tmp_c > 99) { hold_c = tmp_c % 100; cout << "hold_c = " << hold_c << endl;
  • 4. hold_d = tmp_c / 100; cout << "hold_d = " << hold_d << endl; for(int i = 0; i < hold_d; i++) { tmp_d++; } tmp_c = hold_c; } return money(tmp_d, tmp_c); } const money& operator +(const money& lhs, const money& rhs) { int tmp_d = 0; int tmp_c = 0; int hold_c = 0; int hold_d = 0; tmp_d = lhs.dollars + rhs.dollars; tmp_c = lhs.cents + rhs.cents; if(tmp_c > 99) { hold_c = tmp_c % 100; cout << "hold_c = " << hold_c << endl; hold_d = tmp_c / 100; cout << "hold_d = " << hold_d << endl; for(int i = 0; i < hold_d; i++) { tmp_d++; } tmp_c = hold_c; } return money(tmp_d, tmp_c); } bool operator ==(const money& lhs, const money& rhs)
  • 5. { return ((lhs.get_dollars() == rhs.get_dollars()) && (lhs.get_cents() == rhs.get_cents())); } int main() { money m1; money m2(100, 99); money m3(250, 5); cout << "m1 = " << m1 << endl; cout << "m2 = " << m2 << endl; cout << "m3 = " << m3 << endl; m1 = m2 + m3; cout << "m1 = " << m1 << endl; m1 = m1 + 200; cout << "m1 + 200 " << endl; cout << "m1 = " << m1 << endl; cout << "m2 + m3" << endl; cout << "m1 = " << m1 << endl; cout << "m2 == m1 " << endl; cout << "m1 = " << m1 << endl; cout << "m2 = " << m2 << endl; cout << (m2 == m1) << endl; m1 = money(); m2 = money(); cout << "m1 = " << m1 << endl; cout << "m2 = " << m2 << endl; cout << (m2 == m1) << endl; cout << "++m1 " << endl; ++m1; cout << "m1 = " << m1 << endl; cout << "m1++" << endl; cout << m1++ << endl; cout << "m1 = " << m1 << endl; cout << "-m1 = " << -m1 << endl; m2 = money(1, 0);
  • 6. m3 = money(2, 0); money tm; tm = (m3 + -m2); cout << "m3 = " << m3 << endl; cout << "m2 = " << m2 << endl; cout << "(m3 + -m2) = " << tm << endl; m1 = money; m2 = money(101, 78); m3 = money(202, 10); m2 <= m3?cout << "m2 <= m3" << endl; : cout << "m2 is not <= m3" << endl; m2 >= m3?cout << "m2 >= m3" << endl; : cout << "m2 is not >= m3" << endl; m1 = m3 * m2; cout << "m3 * m2 = " << m1 << endl; m1 = m3 - m2; cout << "m3 - m2 = " << m1 << endl; return 0; } Solution #include using namespace std; class money { private: int dollars; int cents; public: money():dollars(0), cents(0){} money(int dollars_in):dollars(dollars_in), cents(0){} money(int dollars_in, int cents_in):dollars(dollars_in), cents(cents_in){}
  • 7. int get_dollars() const; int get_cents() const; void set_dollars(int d_in); void set_cents(int c_in); money operator ++(); money operator ++(int x); money operator +(const money& rhs); money operator *(const money& rhs); friend money operator -(const money& lhs, const money& rhs); friend money operator /(const money& lhs,const money& rhs); money operator -(); friend const money& operator +(const money& lhs, const money& rhs); money operator --(); money operator --(int x); bool operator ==(const money& n); bool operator <=(money n); bool operator >=(money m); }; // do this as a general function money money::operator *(const money& rhs) { int d= dollars*rhs.get_dollars(); int c= cents*rhs.get_cents(); int c1 = c/100; d=d+c1; int c2=c%100; return money(d, c2); } // friend function money operator -(const money& lhs, const money& rhs) { int n = lhs.get_dollars()-rhs.get_dollars(); int c= lhs.get_cents()-rhs.get_cents();
  • 8. if(c<0) { n--; c=c*-1; } return money(n,c); } // friend function division money operator /(const money& lhs, const money& rhs) { int n = lhs.get_dollars()/rhs.get_dollars(); int d= lhs.get_dollars()% rhs.get_dollars(); int c= lhs.get_cents()/rhs.get_cents(); c=c+d; return money(n,c); } money money::operator -() { return money(-get_dollars(), -get_cents()); } money money::operator ++(int blah) { this->dollars=this->dollars+blah; return money(dollars,cents); } money money::operator ++() { dollars++; return money(dollars,cents); } int money::get_dollars() const { return dollars;
  • 9. } int money::get_cents() const { return cents; } void money::set_dollars(int d_in) { dollars = d_in; } void money::set_cents(int c_in) { cents = c_in; } ostream& operator <<(ostream& os, const money& rhs) { os << "$" << rhs.get_dollars() << "."; if(rhs.get_cents() < 10) { os << "0"; } os << rhs.get_cents(); return os; } money money::operator +(const money& rhs) { int tmp_d = 0; int tmp_c = 0; int hold_c = 0; int hold_d = 0; tmp_d = get_dollars() + rhs.get_dollars(); tmp_c = get_cents() + rhs.get_cents(); if(tmp_c > 99) { hold_c = tmp_c % 100; cout << "hold_c = " << hold_c << endl;
  • 10. hold_d = tmp_c / 100; cout << "hold_d = " << hold_d << endl; for(int i = 0; i < hold_d; i++) { tmp_d++; } tmp_c = hold_c; } return money(tmp_d, tmp_c); } const money& operator +(const money& lhs, const money& rhs) { int tmp_d = 0; int tmp_c = 0; int hold_c = 0; int hold_d = 0; tmp_d = lhs.dollars + rhs.dollars; tmp_c = lhs.cents + rhs.cents; if(tmp_c > 99) { hold_c = tmp_c % 100; cout << "hold_c = " << hold_c << endl; hold_d = tmp_c / 100; cout << "hold_d = " << hold_d << endl; for(int i = 0; i < hold_d; i++) { tmp_d++; } tmp_c = hold_c; } return money(tmp_d, tmp_c); } bool money::operator ==(const money& rhs)
  • 11. { return ((get_dollars() == rhs.get_dollars()) && (get_cents() == rhs.get_cents())); } bool money::operator <=(money m) { if(dollars< m.dollars) return true; else if(dollars==m.dollars) { if(cents < m.cents) return true; else if(cents > m.cents) return false; } else return false; } bool money::operator >=(money m) { if(dollars > m.dollars) return true; else if(dollars==m.dollars) { if(cents > m.cents) return true; else if(cents < m.cents) return false; } else return false; } int main() { money m1; money m2(100, 99); money m3(250, 5); cout << "m1 = " << m1 << endl; cout << "m2 = " << m2 << endl; cout << "m3 = " << m3 << endl;
  • 12. m1 = m2 + m3; cout << "m1 = " << m1 << endl; m1 = m1 + 200; cout << "m1 + 200 " << endl; cout << "m1 = " << m1 << endl; cout << "m2 + m3" << endl; cout << "m1 = " << m1 << endl; cout << "m2 == m1 " << endl; cout << "m1 = " << m1 << endl; cout << "m2 = " << m2 << endl; cout << (m2 == m1) << endl; m1 = money(); m2 = money(); cout << "m1 = " << m1 << endl; cout << "m2 = " << m2 << endl; cout << (m2 == m1) << endl; cout << "++m1 " << endl; ++m1; cout << "m1 = " << m1 << endl; cout << "m1++" << endl; cout << m1++ << endl; cout << "m1 = " << m1 << endl; cout << "-m1 = " << -m1 << endl; m2 = money(1, 0); m3 = money(2, 0); money tm; tm = (m3 + -m2); cout << "m3 = " << m3 << endl; cout << "m2 = " << m2 << endl; cout << "(m3 + -m2) = " << tm << endl; m1 = money(); m2 = money(101, 78); m3 = money(202, 10); if(m2 <= m3) cout << "m2 <= m3" << endl;
  • 13. else cout << "m2 is not <= m3" << endl; if(m2 >= m3) cout << "m2 >= m3" << endl; else cout << "m2 is not >= m3" << endl; m1 = m3 * m2; cout << "m3 * m2 = " << m1 << endl; m1 = m3 - m2; cout << "m3 - m2 = " << m1 << endl; return 0; }