CSE 241/505 Homework # 5 solution


Original Work ?
Category: You will Instantly receive a download link for .ZIP solution file upon Payment


5/5 - (2 votes)

You will rewrite your CPUProgram class so that uses vectors and operator overloading. Your CPUProgram class has the same pubic member functions as before but now it supports the following operators • Operator[] that takes an integer and works like the getLine function. It returns the program line as a string. • Operator+ that takes a CPUProgram and an instruction line as a string. It returns a new CPUProgram that has the original CPUProgram with appended last line from the parameter string. • Operator+= that takes an instruction line as a string and appends the instruction to the end of the program. • Operator+ that takes two programs and returns a new program that appends the second programs to the first one • All comparison operators ==, !=, <, =, etc. All comparison operators compare the number of lines of the programs. • Operator that prints the program • Post and pre decrement operators - - that delete the last line of the program. • Function call operator() that takes two integers and returns a new program that contains the instructions between the given integers. You should keep your instruction strings in a vector