Question
template class Points2{ // @c1: A sequence. // @c2: A second sequence. // @return their sum. If the sequences are not of the same size,
template
class Points2{
// @c1: A sequence. // @c2: A second sequence. // @return their sum. If the sequences are not of the same size, append the // result with the remaining part of the larger sequence. friend Points2 operator+(const Points2 &c1, const Points2 &c2) { // Code missing. } private: // Sequence of points. std::array *sequence_; // Size of sequence. size_t size_;
}
Just a sample test function to make things easier for you when testing it
void TestPart2() { Points2 a, b; cout << "Enter a sequence of points (double)" << endl; a.ReadPoints2(); // User provides input for Points2 a. cout << a; cout << "Enter a sequence of points (double)" << endl; b.ReadPoints2(); // User provides input for Points2 b. cout << b << endl; cout << "Result of a + b" << endl; cout << a + b << endl; Points2 d = a + b; cout << "Result of d = a + b" << endl; cout << d; }
And the sample output should be
Enter a sequence of points (double)
(2.1, 20.3) (11.11, 12.45) (13.1, 14.2) Enter a sequence of points (double)
(1.1, 100) (20.1, 30.2)
Result of a + b (3.2, 120.3) (31.21, 42.65) (13.1, 14.2)
Result of d = a + b (3.2, 120.3) (31.21, 42.65) (13.1, 14.2)
So please help me thank you.
Please do not add any data members. please use the data members that is given
Object is just the type name.
and I have provided some details.
I hope this helps.
Thanks.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started