c++ programming, Computer Graphics

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 ;
Posted Date: 3/21/2013 3:51:32 PM | Location : United States

Related Discussions:- c++ programming, Assignment Help, Ask Question on c++ programming, Get Answer, Expert's Help, c++ programming Discussions

Write discussion on c++ programming
Your posts are moderated
Related Questions
The transformation regarding to the mirror reflection to this line L comprises the subsequent basic transformations: 1) Translate the intersection point A(0,c) to the origin, it

Features for good 3-Dimentional modeling software are as: Multiple windows which permit you to view your model in each dimension. Capability to drag and drop primitive

Graphics Tablet - CAD and CAM We need to know what we mean via tablet in computer terminology, before going into details on the graphic tablet, since in the other disciplines

Question 1 Discuss the general properties of analog signal Question 2 Differentiate images and graphics Question 3 Explain the video compression standard H.263

Tablet Computer - CAD and CAM Tablet Computer: it is a complete computer comprises in a touch screen. Tablet computers can be specialized for only Internet utilize or be fu

What do you mean by Perspective projection?  Perspective projection is one in which the lines of projection are not parallel. Instead, they all converge at a single point known

Perspective Projections - Transformation In this projection the center of projection is at limited distance. This projection is termed as perspective projection since in this

Question 1 Explain Bresenham's Circle Drawing Algorithm Question 2 Derive the matrix for inverse transformation Question 3 Discuss the following Raster Graphic Algorithm