QuestionQuestion

1. Code a simple push_front and pop_back functions C++ program for the STL class deque.

2. Write a simple C++ recursive function repeater program which returns a string with each character in its argument repeated.

Solution PreviewSolution Preview

These solutions may offer step-by-step problem-solving explanations or good writing examples that include modern styles of formatting and construction of bibliographies out of text citations and references. Students may use these solutions for personal skill-building and practice. Unethical use is strictly forbidden.

#include <cstdlib>
#include <iostream>
#include <deque>

using namespace std;


// 4d. Code a simple push_front and pop_back functions C++
// program for the STL class deque.

int main(int argc, char** argv) {
   
    // variable declaration
    int val = 1;
    deque<int> dq;
   
    // push value to the front of the queue
    // stop when user enters 0
    while (val != 0) {
       cout << "Enter a number to push to the deque, enter 0 to stop: ";
       cin >> val;
       if (val != 0) {
            dq.push_front(val);
       }
    }

    // while the queue is not empty
    // show back of the queue
    // then pop it out
    while (dq.empty() == false) {...

By purchasing this solution you'll be able to access the following files:
Solution1.cpp and Solution2.cpp.

$12.00
for this solution

or FREE if you
register a new account!

PayPal, G Pay, ApplePay, Amazon Pay, and all major credit cards accepted.

Find A Tutor

View available C-Family Programming Tutors

Get College Homework Help.

Are you sure you don't want to upload any files?

Fast tutor response requires as much info as possible.

Decision:
Upload a file
Continue without uploading

SUBMIT YOUR HOMEWORK
We couldn't find that subject.
Please select the best match from the list below.

We'll send you an email right away. If it's not in your inbox, check your spam folder.

  • 1
  • 2
  • 3
Live Chats