______ is intended to permit others to perform, show, quote, copy, and otherwise distribute portions of the work for certain purposes.
A. Reverse engineering
B. Personal privacy
C. Fair use
D. Encryption research
C. Fair use
You might also like to view...
What option do you use if you want to return a VM to an intermediate snapshot between the original VM and its current state?
A. Revert B. Return C. Save D. Apply
You can place a digital image in Illustrator using the ____.
A. Place tool B. Place command C. Import command D. Insert command
The ________ logical operator evaluates if all of the criteria outcomes in a query are true
Fill in the blank(s) with correct word
Consider class Complex shown in Figs. 11.1–11.3. The class enables opera- tions on so-called complex numbers. These are numbers of the form realPart + imaginaryPart * i, where i has the value ?-1
a) Modify the class to enable input and output of complex numbers through the overloaded >> and << operators, respectively (you should remove the print function from the class). b) Overload the multiplication operator to enable multiplication of two complex numbers as in algebra. c) Overload the == and != operators to allow comparisons of complex numbers. Fig. 11.1 Complex class definition.
// Complex class definition. #ifndef COMPLEX_H #define COMPLEX_H class Complex { public: Complex( double = 0.0, double = 0.0 ); // constructor Complex operator+( const Complex & ) const; // addition Complex operator-( const Complex & ) const; // subtraction void print() const; // output private: double real; // real part double imaginary; // imaginary part }; // end class Complex #endifFig. 11.2 | Complex class member-function definitions.
// Complex class member-function definitions. #includeFig. 11.3 | Complex numbers.#include "Complex.h" // Complex class definition using namespace std; // Constructor Complex::Complex( double realPart, double imaginaryPart ) : real( realPart ), imaginary( imaginaryPart ) { // empty body } // end Complex constructor // addition operator Complex Complex::operator+( const Complex &operand2 ) const { return Complex( real + operand2.real, imaginary + operand2.imaginary ); } // end function operator+ // subtraction operator Complex Complex::operator-( const Complex &operand2 ) const { return Complex( real - operand2.real, imaginary - operand2.imaginary ); } // end function operator- // display a Complex object in the form: (a, b) void Complex::print() const { cout << '(' << real << ", " << imaginary << ')'; } // end function print
// Complex class test program. #includex: (0, 0) y: (4.3, 8.2) z: (3.3, 1.1) x = y + z: (7.6, 9.3) = (4.3, 8.2) + (3.3, 1.1) x = y - z: (1, 7.1) = (4.3, 8.2) - (3.3, 1.1)#include "Complex.h" using namespace std; int main() { Complex x; Complex y( 4.3, 8.2 ); Complex z( 3.3, 1.1 ); cout << "x: "; x.print(); cout << "\ny: "; y.print(); cout << "\nz: "; z.print(); x = y + z; cout << "\n\nx = y + z:" << endl; x.print(); cout << " = "; y.print(); cout << " + "; z.print(); x = y - z; cout << "\n\nx = y - z:" << endl; x.print(); cout << " = "; y.print(); cout << " - "; z.print(); cout << endl; } // end main