1. Stack object data structures do not contain code to throw an exception when a stack.pop() function is called on an empty stack. This is due to the fact that it is easy to establish this exception handing elsewhere. Create a class named SafeStack that implements a stack of strings.
Use an instance of stack from <string> to hold string values and implement the same interface as the data type. However, your implementation (class) should throw an exception if an attempt is made to remove a value from an empty stack.

2. Letter frequencies.
If you were to encrypt a file using the cipher, the letters will mixed up, and will appear as that you cannot decrypt it without the keyword. Also, it would seem illogical to try and guess the keyword, but someone who is trained in decryption would have no trouble breaking the cipher. The average letter frequencies of English letters are common knowledge. The most common letter E, occurs about 13% of the time.

Write a program that reads as an input file and shows the letter frequencies in the file. This tool is invaluable to a code breaker. If the most frequent letters are H and K there is a high probability that they are the encryptions of E and T.

Solution PreviewSolution Preview

This material may consist of step-by-step explanations on how to solve a problem or examples of proper writing, including the use of citations, references, bibliographies, and formatting. This material is made available for the sole purpose of studying and learning - misuse is strictly forbidden.



#include <stack>
#include <string>
#include <exception>
using namespace std;

class SafeStack {
    virtual ~SafeStack();
    bool empty() const;
    void pop();
    void push(string str);
    int size() const;
    string & top() ;
    stack<string> s;

#endif /* SAFESTACK_H */...
$40.00 for this solution

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.

Upload a file
Continue without uploading

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