Can someone please help me for this assignment

Assignment Help Basic Computer Science
Reference no: EM132335752

Question

This is C++ course. Can someone please help me for this assignment? I'm not sure that my code is right or wrong.

If is wrong can you tell me where did I wrong? Could someone please explain to me this assignment step by step? I really want to understand what teacher want me to write code.

For all assignments in CIS 22B, use heading comments at the top with the following format:

Cryptography - the science of secret writing - is an old science; the first recorded use was well before

1900 B.C. An Egyptian writer used previously unknown hieroglyphs in an inscription.

We will use a simple substitution cypher called rot13 to encode and decode our secret messages.

ROT13 ("rotate by 13 places", sometimes hyphenated ROT-13) is a simple letter substitution cipher that replaces a letter with the 13th letter after it, in the alphabet. ROT13 is a special case of the Caesar cipher which was developed in ancient Rome.

Decryption Key

A|B|C|D|E|F|G|H|I|J|K|L|M

-------------------------

N|O|P|Q|R|S|T|U|V|W|X|Y|Z

(letter above equals below, and vice versa)

As you can see, A becomes N, B becomes O and so on.

Your job is to write a program, with at least four functions, including main, which must do the following:

1. Ask user whether they want to encode or decode a message - if no, then terminate

2. Take the input string from the user, store it in dynamic memory (use new)

3. As appropriate, encode or decode the message using Rot13.

4. Output the encoded/decoded message

5. Delete the input string from dynamic memory (use delete)

Input will be a string of no more than 25 characters.

Blanks get replaced with blanks.

Do not worry about punctuation; there will be no punctuation in the string.

ALPHABET becomes NYCUNORG

Test your program with the following strings:

TAF VF

 paddrpf

I'll be using other strings to test your code.

This is the code that I write but not sure it is correct or not

#include <iostream>

#include <string>

using namespace std;

string rot13 (string input);

int main() {

  string plaintext;

  string cypher;

  cout << "input:";

  getline(cin,plaintext);

  cypher = rot13 (plaintext);

  cout << cypher << endl;

  plaintext = rot13(cypher);

  cout << plaintext << endl;

  return 0;

}

string rot13 (string input)

{

  int inputSize = input.size();

  int index = 0;

  while (index != inputSize)

  {

    if (input [index] >= 97 && input [index] <=109)

      input [index] = input [index] + 13;

    else if (input[index] >= 110 && input [index] <= 122)

      input [index] = input [index] - 13;

    else if (input[index]>= 65 && input [index] <= 77)

      input [index] = input [index] + 13;

    else if (input [index]>= 78 && input [index] <= 90)

       input [index] = input [index] - 13;

    index++;

    }

    return input;

}

Reference no: EM132335752

Questions Cloud

Suppose the bank of america reduces money : Suppose the Bank Of America reduces money supply by 5 percent. a. What happens to aggregate demand curve
Expansion or contraction of the particular industries : What are the implications of the profit changes for expansion or contraction of the particular industries?
How important is price uncertainty vs whether prices : How important is price uncertainty vs. whether prices are expected to simply increase or decrease in the oil industry
Display helps to understand the data better : One group of tools are called data visualization tools. Visit the website below and select one of the methods of data display for a topic
Can someone please help me for this assignment : This is C++ course. Can someone please help me for this assignment? I'm not sure that my code is right or wrong.
What the bible says about the role of government : Explain how the following Biblical concepts contribute to what the Bible says about the role of government: Institutional separation of church and state.
Compare and contrast the effectiveness of classic models : Compare and contrast the effectiveness of classic models and recently evolved models such as Big Data and NoSQL.
Evaluate significance of research on specific policy change : This week, you evaluate the significance of research on specific policy change and analyze its role in policy analysis. You also begin your criminal justice.
Types of databases that would be useful for small businesses : Suggest at least two types of databases that would be useful for small businesses, two types for regional level organizations and two types for internationally

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Bank over the life of the loan

He will make equal monthly payments for the next 30 years. How much money will he end up paying the bank over the life of the loan, and how much is the interest? How much will he owe after 20 years?

  To ensure that a suitable level of security is maintained

IT security management has evolved considerably over the last few decades due to the rise in risks to networked systems.

  Determine the pressure and the internal energy

Refrigerant-134a at 800 kPa and 25°C is throttled to a temperature of -20°C. Determine the pressure and the internal energy of the refrigerant at the final state.

  Describe the project the risks the mitigation plan

Recall a project that you considered at one time but decided against during the initiation phase because the risks were too great or the mitigation plan was insufficient to proceed. Describe the project, the risks, the mitigation plan, and why you..

  Write a few sentences describing this distribution

Without doing any calculations, which must be larger: the median or the mean? Explain how you know.

  Factors for successful production and entrepreneurship

In economic theory there are three major factors for successful production and entrepreneurship.

  Java interface construct to formally specify

What are the benefits we accrue by using a Java interface construct to formally specify the logical level of ADTs?Suppose we have a linked list of Strings, as defined in the textbook, named presidents. Suppose it contains three nodes, with the fir..

  When you allow an ice cube to melt at room temperature

When you allow an ice cube to melt at room temperature, what is the state of molecules in the liquid water?

  Linux for beginners video summary

It is important to note that in any given enterprise the operating system available for computing environment can be different.  Upon watching the video, please provide a summary of your understanding of the video.  The rubric for this assignment ..

  Align incentives and improve profitability

Identify a principal-agent problem in your company and evaluate the tools it uses to align incentives and improve profitability. (Southwest Airlines)

  What could be causing the problem

Joe was told that the Remote Assistance feature was not working for users after a new firewall was installed. What could be causing the problem?

  Administrator to implement shell scripting

Why is it important for a network administrator to implement shell scripting?

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd