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

Jpeg graphics, JPEG Graphics: Another graphic file format usually utilized...

JPEG Graphics: Another graphic file format usually utilized on the Web to minimize graphics file sizes is the Joint Photographic Experts Group that is JPEG compression scheme. Not

Mathematics-applications for computer animation, Mathematics: There are so...

Mathematics: There are some area like Probability, combination, permutation, etc.,that can be well explained along with the help of animation, that helps in enhancing the learning

Gui and graphics, Newspapers exchange news by using news agencies (such as ...

Newspapers exchange news by using news agencies (such as Reuters and ITARTASS). A newspaper registers at a news agency and sends all its news to the agency. The news agency collect

What is the purpose behind the staircase effect, 1. What is the purpose be...

1. What is the purpose behind the Staircase effect? Ans. The approximation concerned in the calculation for finding of pixel position concerned in the display of lines and th

Categories of reflection - ray tracing methods , Categories of Reflection -...

Categories of Reflection - Ray Tracing Methods In order to achieve realism, such phenomenon of reflection, which occurs because of interaction of light and surface, is require

Img- mac-msp file formats, IMG/MAC/MSP File Formats IMG files were orig...

IMG/MAC/MSP File Formats IMG files were originally implemented to work along with GEM paint program and can handle monochrome and grey level pictures only. MAC files are uti

Assignemt, i need help in my Engineering graphic assignment

i need help in my Engineering graphic assignment

What is transformation, What is Transformation?  Transformation is the ...

What is Transformation?  Transformation is the method of introducing changes in the shape size and orientation of the object using scaling rotation reflection shearing & transl

What do you understand by the term contone, Question : (a) What do you...

Question : (a) What do you understand by the term ‘contone'? (b) What are spot colours? (c) You have been asked to prepare an artwork (a magazine) to send to a printer.

Difference of gaussians, Difference of Gaussians In this project we wi...

Difference of Gaussians In this project we will implement the difference of Gaussians (DoG) edge detector and learn its characteristics. Part A: Design and implement a proc

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