Define a type Vec4 as a vector of four floats. Define operator[]…
Question Answered step-by-step Define a type Vec4 as a vector of four floats. Define operator[]… Define a type Vec4 as a vector of four floats. Define operator[] for Vec4. Define opera-tors +, −, ∗, /, =, +=, −=, ∗=, and /= for combinations of vectors and floating-point numbers.[10] ( ∗3) Define a class Mat4 as a vector of four Vec4s. Define operator[] to return a Vec4 for Mat4.Define the usual matrix operations for this type. Define a function doing Gaussian elimina-tion for a Mat4.[11] ( ∗2) Define a class Vector similar to Vec4 but with the size given as an argument to the con-structor Vector::Vector(int).[12] ( ∗3) Define a class Matrix similar to Mat4 but with the dimensions given as arguments to theconstructor Matrix::Matrix(int,int).[13] ( ∗1) Given two structures:struct S { int x, y; }struct T { char∗ p; char∗ q; };write a class C that allows the use of x and p from some S and T, much as if x and p had beenmembers of C. Hint: pointer to member.[14] ( ∗1.5) Define a class Index to hold the index for an exponentiation function mypow(dou-ble,Index). Find a way to have 2∗∗I call mypow(2,I).[15] ( ∗2) Define a class Imaginary to represent imaginary numbers. Define class Complex based onthat. Implement the fundamental arithmetic operators. Define i as a user-defined literal suf-fix meaning ”imaginary.’) Provide a substring operator for a string class by overloading (). What other operationsAssume a simple movie database with the following schema. (You may assume that producers have a unique certification number, Cert, that is also recorded in the Movie relation as attribute prodC#; and no two movies are produced with the same title.)Movie(title,year,length,prodC#) StarsIn(movieTitle,movieYear,starName) Producer(name,address,cert) MovieStar(name,gender,birthdate)(a) Write the following queries in SQL:(i) Who were the male stars in the film The Red Squirrel? [1 mark](ii) Which movies are longer than Titanic? [2 marks](b) SQL has a boolean-valued operator IN such that the expression s IN R is true when s is contained in the relation R (assume for simplicity that R is a single attribute relation and hence s is a simple atomic value).Consider the following nested SQL query that uses the IN operator:SELECT name FROM Producer WHERE cert IN (SELECT prodC# FROM Movie WHERE title IN (SELECT movieTitle FROM StarsIn WHERE starName=’Nancho Novo’));[7] ( ∗2) Write a program that has been rendered unreadable through use of operator overloadingand macros. An idea: Define + to mean − and vice versa for INTs. Then, use a macro todefine int to mean INT. Redefine popular functions using reference type arguments. Writinga few misleading comments can also create great confusion.would you like to be able to do on a string?[4] ( ∗3) Design class String so that the substring operator can be used on the left-hand side of anassignment. First, write a version in which a string can be assigned to a substring of thesame length. Then, write a version in which the lengths may differ.D Computer Science Engineering & Technology C++ Programming FIN 5733 Share QuestionEmailCopy link Comments (0)


