
Using the attached program (AirportCombos.cpp), create a list of strings to process and place on a STL STACK container. The provided code is meant to be generic.
Using the provided 3 char airport codes, create a 6 character string that is the origin & destination city pair. Create all the possible origin/destinations possible combinations from the airport codes provided. Load the origin/destination string onto a stack for processing. Do not load same/same values, such as DALDAL, or LAXLAX. See comments in the program from more details.
After loading the values, Create a loop to display all the values in the container. This loop should inherently remove items as they are displayed.
Deliverable is a working CPP program.
![code.cpp ) No Selection
C++
Create all the possible origin/destinations from the airport codes provided.
Load the origin/destination string onto a stack or queue for processing
1
3
4 */|
7 // MS Visual Studio 2015 uses "stdafx.h"
2017 uses "pch.h"
8
//#include "stdafx.h"
9 |/#include "pch.h"
10
11
12
#include <iostream>
13
#include <string>
14
15
using namespace std;
16
const int AIRPORT_COUNT =
string airports[AIRPORT_COUNT]
{"DAL","ABQ","DEN","MSY","HOU","SAT","CRP","MID","OKC","OMA","MDW","TUL"};
17
12;
18
%3D
19
20
int main()
21
{
22
// define stack (or queue ) here
23
string origin;
string dest;
string citypair;
24
25
26
27
cout << "Loading the CONTAINER
// LOAD THE STACK ( or queue) HERE
// Create all the possible Airport combinations that could exist from the list provided.
// i.e DALABQ, DALDEN,
// DO NOT Load SameSame
28
<« endl;
29
30
...., ABQDAL, ABQDEN
DALDAL, ABQABQ, etc
31
32
33
34
<< endl;
cout << "Getting data from the CONTAINER
// Retrieve data from the STACK/QUEUE here
35
•. I"
36
37
38
39
}
40](https://content.bartleby.com/qna-images/question/98856484-cfe4-4b99-b613-d8917fb53fcb/b02655fe-2275-4220-8ac8-85c414e571a5/8y1j0h_thumbnail.png)

Trending nowThis is a popular solution!
Step by stepSolved in 2 steps

- What is the best way to implement a stack or a queue so that it can hold an arbitrary number of elements? Select one: a. Using an array, and throwing an exception when the stack or queue is full. b. By creating a bigger array when the stack or queue is full, and copying the elements from the original array. c. Using linked lists to store the collection of elements.arrow_forwardWrite a BCPL program that reads a sequence of strings typed by the user and creates a linked list containing them all. But there will be some special command words. These should be obeyed but not inserted into the list An input of END will be used to mark the end of the input sequence. The progrm should stop. An input of ALL means that the whole list should be printed. It is perfectly OK for the list to come out backwards. An input of DELETE means that the next word is to be removed from the list and its memory (for the link object and for the string) must be recycled with freevec (even though freevec doesn't do anything yet). Remember you will need to implement and use strdup(). Remember that strings are packed, four bytes per word, into an array. You use the "byte N of S" syntax to access the individual bytes. Also remember that an extra 0 byte is added to mark the end of the string. Example run: $ run hw4 Enter the strings and deletions: > hello > this > program > works…arrow_forwardSuppose you were storing a collection of n words into a container, and wanted to be able to retrieve (find) any word in O(n) time (or faster). Which of the following STL containers would work? SELECT ALL THAT APPLY list priority_queue queue vector set stackarrow_forward
- Given a singly linked list L, where x and y are two data elements that occupy the nodes NODEX and NODEY with PREVIOUSX as the node, which is the previous node of NODEX, write a pseudo-code to swap the date x and y in list L by manipulating the links only (data swapping is not allowed). Assume that x and y are available in the list and are neither neighbors nor the end nodes of list L. For example, given the list L shown in Figure P6.10(a), with L, NODEX, NODEY and PREVIOUSX marked on it, the swapping should yield the list shown in Figure P6.10(b). NODEX and NODEY are neither immediate neighbors nor the end nodes of list L. Th PREVIOUS X NODE X ‘oddada g c PREVIOUS X (a) Before swapping g and x NODE Y с NODE Y X NODE X addgħa W (b) After swapping g and x Figure P6.10. Swapping of elements in a singly linked list by manipulating links iarrow_forwardCreate a computer programme to arrange objects in a stack so that the smallest ones are on top. Although you are allowed to utilise an extra temporary stack, you are not allowed to transfer the components into another data structure (such an array). The following operations are supported by the stack: push, pop, peek, and is Empty.arrow_forwardThis program will use an array implementation of a linked list to keep an ascending sorted list of numbers. The input data consists of two fields: a single character and an integer value. The single character gets interpreted as one of the following: A - represents a value that is to be added to the linked listD - represents a value to be deleted from the linked listP - indicates that all values are to be printed in ascending order The character is only used to determine which process is to be executed; it should not be printed, entered into the linked list, or processed in any way. The main program should be mainly function calls. Process input data until end of file. All output should be sent to an output file and be appropriately formatted and labeled. Keep a running log of everything that is going on in the processing. Input file: A 54A -17A 32 A 81 A -30 A 18 P A 41 A 93 A 65 A 80 A 104 A -20 D 81 D 54 D -30 A 79 A 63 A 77 A –33 D 104 D -20 D 80 D 32 Parrow_forward
- You will create two programs. The first one will use the data structure Stack and the other program will use the data structure Queue. Keep in mind that you should already know from your video and free textbook that Java uses a LinkedList integration for Queue. Stack Program Create a deck of cards using an array (Array size 15). Each card is an object. So you will have to create a Card class that has a value (1 - 10, Jack, Queen, King, Ace) and suit (clubs, diamonds, heart, spade). You will create a stack and randomly pick a card from the deck to put be pushed onto the stack. You will repeat this 5 times. Then you will take cards off the top of the stack (pop) and reveal the values of the cards in the output. As a challenge, you may have the user guess the value and suit of the card at the bottom of the stack. Queue Program There is a new concert coming to town. This concert is popular and has a long line. The line uses the data structure Queue. The people in the line are objects…arrow_forwardJAVA PROGRAMMING Arrays are useful to process lists. A top-level domain (TLD) name is the last part of an Internet domain name like .com in example.com. A core generic top-level domain (core gTLD) is a TLD that is either .com, .net, .org, or .info. A restricted top-level domain is a TLD that is either .biz, .name, or .pro. A second-level domain is a single name that precedes a TLD as in apple in apple.com. The following program repeatedly prompts for a domain name, and indicates whether that domain name consists of a second-level domain followed by a core gTLD. Valid core gTLD's are stored in an array. For this program, a valid domain name must contain only one period, such as apple.com, but not support.apple.com. The program ends when the user presses just the Enter key in response to a prompt. 1-Run the program and enter domain names to validate. 2-Extend the program to also recognize restricted TLDs using an array, and statements to validate against that array. The program should…arrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education





