Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please help me code the following! Please read carefully. Full points will be awarded, thanks in advance Queue and LongInt Problenm Consider the LongInt class

Please help me code the following! Please read carefully.

Full points will be awarded, thanks in advance

image text in transcribedimage text in transcribedimage text in transcribed

Queue and LongInt Problenm Consider the LongInt class we have implemented in programming assignment 7. Code a new public function named shiftleft( ) that shifts its long integer left by just one bit (but not by a digit). Assume that all public and private functions listed in the following header file (of course, except shiftleft )) have been already implemented. However, you must not use operatort and operator- to implement the shiftleft ) function. (Otherwise, this question is too easy.) Hint: "shift left by 1 bit means multiply by 2". The deque.h file #ifndef DEQUE H #define DEQUE H #include using namespace std; template class Deque public: // the constructor /7 the copy constructor // the destructor /7 checks if a deque is empty. // retrieves # deque nodes // retrieve the front node // retrieve the tail node /7 clean up all deque entries //add a new node to the front /add a new node to the tail // remove the front node // remove the tail node Deque): Deque (const Deque &rhs); Deque bool isEmpty) const: nt size const: const Object &getFront ( const; const Object &getBack const: void clear void addFront( const Object &obj void addBack( const object &obj Object removeFront): Object removeBack) const Deque &operator-( const Deque &rhs; 1/ assignment private: // a deque node struct DequeNode Object item; DequeNode *next; DequeNode prev; DequeNode *front: DequeNode *back; #include #endif "deque.cpp" The longint,h file #Ifndef LONG!NT H #define LONG!NT H #include include "deque . h" using namespace std; class LongInt friend istream &operator>>( istream &in, LongInt &rhs ; friend ostream &operator const LongInt & rhs ) const: bool operator>=( const LongInt & rhs ) const; bool operatorconst LongInt & rhs const: bool operator! const LongInt & rhs const: // a new function const LongInt &shiftleft private: Deque digits ; bool negative: void removeos 0: #endif Queue and LongInt Problenm Consider the LongInt class we have implemented in programming assignment 7. Code a new public function named shiftleft( ) that shifts its long integer left by just one bit (but not by a digit). Assume that all public and private functions listed in the following header file (of course, except shiftleft )) have been already implemented. However, you must not use operatort and operator- to implement the shiftleft ) function. (Otherwise, this question is too easy.) Hint: "shift left by 1 bit means multiply by 2". The deque.h file #ifndef DEQUE H #define DEQUE H #include using namespace std; template class Deque public: // the constructor /7 the copy constructor // the destructor /7 checks if a deque is empty. // retrieves # deque nodes // retrieve the front node // retrieve the tail node /7 clean up all deque entries //add a new node to the front /add a new node to the tail // remove the front node // remove the tail node Deque): Deque (const Deque &rhs); Deque bool isEmpty) const: nt size const: const Object &getFront ( const; const Object &getBack const: void clear void addFront( const Object &obj void addBack( const object &obj Object removeFront): Object removeBack) const Deque &operator-( const Deque &rhs; 1/ assignment private: // a deque node struct DequeNode Object item; DequeNode *next; DequeNode prev; DequeNode *front: DequeNode *back; #include #endif "deque.cpp" The longint,h file #Ifndef LONG!NT H #define LONG!NT H #include include "deque . h" using namespace std; class LongInt friend istream &operator>>( istream &in, LongInt &rhs ; friend ostream &operator const LongInt & rhs ) const: bool operator>=( const LongInt & rhs ) const; bool operatorconst LongInt & rhs const: bool operator! const LongInt & rhs const: // a new function const LongInt &shiftleft private: Deque digits ; bool negative: void removeos 0: #endif

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Postgresql 16 Administration Cookbook Solve Real World Database Administration Challenges With 180+ Practical Recipes And Best Practices

Authors: Gianni Ciolli ,Boriss Mejias ,Jimmy Angelakos ,Vibhor Kumar ,Simon Riggs

1st Edition

1835460585, 978-1835460580

More Books

Students also viewed these Databases questions

Question

Networking is a two-way street. Discuss this statement.

Answered: 1 week ago