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

De casteljau algorithm - 2d clipping algorithms, De Casteljau Algorithm ...

De Casteljau Algorithm For computation of Bézier curves an iterative algorithm known as de Casteljau algorithm is used.  The algorithm uses repeated linear interpolation.

Objectives of curves and surfaces - modeling and rendering, Objectives of C...

Objectives of Curves and surfaces - modeling and rendering After going through the section, you should be capable to: Implement the methods utilized to represent a pol

What is the minimum amount of video ram, Consider a raster system with the ...

Consider a raster system with the resolution of 1024 x 768 pixels and the color palette calls for 65,536 colors. What is the minimum amount of video RAM that the computer must have

Image capture formats, Image Capture Formats: Video cameras appear in...

Image Capture Formats: Video cameras appear in two various image capture formats: progressive and interlaced scan. Interlaced Scan It is a technique of enhancing the

What do you understood by the term graphic primitives, 1. What do you unde...

1. What do you understood by the term graphic primitives? Ans. Graphic primitives are the basic graphic objects that can be united in any number and method to produce a new i

Differentiate between raster and vector images, QUESTION a) Differentia...

QUESTION a) Differentiate between raster and vector images. b) Explain the concept of bit depth. What is the minimum number if bits required for a one-colour digital image t

Poser - software to generate computer animations, Poser - software to gener...

Poser - software to generate computer animations Poser: Poser through Curious Labs Creates 3-dimentaional complex models which you can view from any angle, distance o

Rotation - 2-d and 3-d transformations, Rotation - 2-d and 3-d transformati...

Rotation - 2-d and 3-d transformations Given a 2-D point P(x,y), that we want to rotate, along with respect to an arbitrary point A(h,k). Suppose P'(x'y') be the effect of ant

Aspect ratio - display devices, Aspect ratio - Display Devices Ratio of...

Aspect ratio - Display Devices Ratio of vertical points to horizontal points necessary to produce equal length lines in both directions on the screen. For example, in a CRT mon

Types of animation systems - computer animation, Types of Animation Systems...

Types of Animation Systems - Computer Animation We have discussed above about the sequencing of animation is helpful in developing any animation. Such sequencing is more or le

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