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
Software for computer animation Whether you might have the excellent hardware in the world, but without a high-quality software package, your hardware can act nothing. There

Find Out Projection Matrix for Oblique Projection To find out projection matrix for oblique projection, we want to find out the direction vector d. Because vector PP' and vect

Q.   Explain the concept of area subdivision method. Write the conditions, when no further subdivision is needed and how we can test these condition. Ans. Area Subdivision Th

QUESTION 1. You are a consultant in the field of video production and video editing. You haven been requested to participate in a debate over analog and digital video. Write

name some of the standard motion in key frames

Adobe Premiere - Softwares for computer animation It just like the name as is generated by Adobe. This is a tool used to composite digitized video, stills and applies a variet


Objectives of Viewing transformation After going through this section, you should be capable to: - Explain the projection; - Classify different types of Perspective and

Interpolation of surface - Polygon Rendering Interpolation of surface normals beside the polygonedge between two vertices is demonstrated above in the figure 15. Here the norm

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