Ex. 8.1 — Stack, vector, queue, and array
You cannot submit for this problem because the homework's deadline is due.
File
Just compress your ex1.cpp
, which has #include "assignment.h"
and doesn't has main()
function
Description
Write three C++ functions which read strings from the standard input and print them in the
reverse order. The first program should be implemented using an array, the second one using a
vector and the third one using a stack. Argue on the best choice in the README file.Write three C++ functions which read strings from the standard input and print them in the input order. The first program should be implemented using an array, the second one using a vector and the third one using a queue. Argue on the best choice in the README file.
The declaration of functions in assignment.h
are:
void ex1_reverse_array();
void ex1_reverse_vector();
void ex1_reverse_stack();
void ex1_ordered_array();
void ex1_ordered_vector();
void ex1_ordered_queue();
Format
Input
a single line containing space separated strings
Output
a single line containing space separated strings
Sample 1 (reversed)
Input
ab bc cd
Output
cd bc ab
Sample 2 (ordered)
Input
a b c
Output
a b c
Limitation
1s, 32MiB for each test case.
Homework 8 (Individual)
- Status
- Finished
- Problems
- 1
- Open Since
- 2019-11-24 00:00
- DDL
- 2019-12-04 23:59
- Extension
- 72.0 hour(s)