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

Panning and zooning, what is zooming and panning in computer graph please e...

what is zooming and panning in computer graph please explan??

Character generation, Ask question #Minimum how can we use stroke method me...

Ask question #Minimum how can we use stroke method method for character generation? 100 words accepted#

Question, what are the steps involved in 3d transformation explain

what are the steps involved in 3d transformation explain

Mpeg-2 , MPEG-2 : MPEG-2 that is Moving Picture Experts Group format 2 is ...

MPEG-2 : MPEG-2 that is Moving Picture Experts Group format 2 is the standard used through DVD and is of a much higher quality than MPEG- 1. This format gives for 720 x 480 resolu

High level techniques - motion specification, High Level Techniques (Motion...

High Level Techniques (Motion Generalized) These are techniques utilized to explain the general motion behavior of any type of graphic object. Such techniques are algorithms o

Define emissive and non-emissive displays, What do you mean by emissive and...

What do you mean by emissive and non-emissive displays?  The emissive display changes electrical energy into light energy. The plasma panels, thin film electro-luminescent disp

Design a graphical user interface, 1. Implement proper exception handling m...

1. Implement proper exception handling mechanism for this application. 2. Display all data a. Search specific data (depending of the user selection, your application should e

Write a note on mpeg-2, Question 1 Write a note on digitizers Quest...

Question 1 Write a note on digitizers Question 2 Discuss on line drawing algorithm Question 3 Explain 3D viewing Question 4 Explain different types of cohe

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