c++ programming, Computer Graphics

Assignment Help:
self test exercise 17 asked you to overload the operator >> and the operator << for a class Pairs. Complete and test this exercise. Implement the default constructor and the constructors with one and two int parameters. The one parameter constructor should initialize the first member of the pair; teh second member of the pair is to be 0.
Overload biinary operator + to add pairs according to the rule
(a, b) + (c, d) = (a + c, b, + d)
overload operator - analogously
overload operator * on Pairs and int according to the rule
(a, b) * c + (a * c, b * c)
write a program to test all the member functions and overloaded operators in your class definition

istream& operator >> (istream& ins, Pairs& second)
{
char ch;
ins >> ch; // discard initial ''(''
ins >> second. f;
ins >> ch; // discard comma '', ''
ins >> second. s;
ins >> ch; // discard final '') ''
return ins;
}
ostream& operator << (ostream& outs, const Pairs& second)
{

outs << ''( '';
outs << second. f;
outs << '', ''; // you might prefer ", "
// to get an extra space
outs << second. s;
outs << '')'' ;
return outs ;
}

Related Discussions:- c++ programming

Pcs or personal computers really - hardware for animation, PCs or Personal ...

PCs or Personal Computers Really - Hardware for Animation  these are really versatile machines that have been around for years. PCs are the favorite of many computer users, due

Determine the transformation matrix for cavalier projection, Determine the ...

Determine the transformation matrix for: a) Cavalier projection with θ=45 0 , and b) Cabinet projection with θ=30 0    c) Draw the projection of unit cube for all transfor

Interfacing lcd liquid crystal display, Main Objectives: Interfacing...

Main Objectives: Interfacing LCD to the Micro-controller (PIC18F4520) Programming LCD by using C- language via MPLAB Sending data or command to the LCD Component

Describe fully the term preflight, Question: Adobe InDesign software ...

Question: Adobe InDesign software is used to create works such as posters, flyers, brochures, magazines and books. Designers and graphics production artists are the principa

What is 2-dimensional transformation, 2-DIMENSIONAL TRANSFORMATION Mode...

2-DIMENSIONAL TRANSFORMATION Modeling transformation is the mechanism to compose an image from modeling  primitives. The modeling primitives are defined in their own coordinate

What you mean by parallel projection, What you mean by parallel projection?...

What you mean by parallel projection?  Parallel projection is one in which z coordinates is discarded and parallel lines from every vertex on the object are extended unless the

Interchange file format, IFF: It is Amiga Interchange File Format which is...

IFF: It is Amiga Interchange File Format which is used to transfer documents to and from Commodore Amiga Computers. This format is really flexible and permits images and text to b

Morphing - key frame systems, Morphing - Key Frame Systems Transformati...

Morphing - Key Frame Systems Transformation of object shapes from one form to the other is termed as morphing as short form of metamorphism. This method can be applied to any o

Bezier cubic curves, Q.   What are Bezier cubic curves? Derive their proper...

Q.   What are Bezier cubic curves? Derive their properties. OR  What are Bezier cubic curves? Derive these properties. Also show that the sum of the blending functions is identical

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd