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

  Identifies the cost of computer

identifies the cost of computer components to configure a computer system (including all peripheral devices where needed) for use in one of the following four situations:

  Input devices

Compare how the gestures data is generated and represented for interpretation in each of the following input devices. In your comparison, consider the data formats (radio waves, electrical signal, sound, etc.), device drivers, operating systems suppo..

  Cores on computer systems

Assignment : Cores on Computer Systems:  Differentiate between multiprocessor systems and many-core systems in terms of power efficiency, cost benefit analysis, instructions processing efficiency, and packaging form factors.

  Prepare an annual budget in an excel spreadsheet

Prepare working solutions in Excel that will manage the annual budget

  Write a research paper in relation to a software design

Research paper in relation to a Software Design related topic

  Describe the forest, domain, ou, and trust configuration

Describe the forest, domain, OU, and trust configuration for Bluesky. Include a chart or diagram of the current configuration. Currently Bluesky has a single domain and default OU structure.

  Construct a truth table for the boolean expression

Construct a truth table for the Boolean expressions ABC + A'B'C' ABC + AB'C' + A'B'C' A(BC' + B'C)

  Evaluate the cost of materials

Evaluate the cost of materials

  The marie simulator

Depending on how comfortable you are with using the MARIE simulator after reading

  What is the main advantage of using master pages

What is the main advantage of using master pages. Explain the purpose and advantage of using styles.

  Describe the three fundamental models of distributed systems

Explain the two approaches to packet delivery by the network layer in Distributed Systems. Describe the three fundamental models of Distributed Systems

  Distinguish between caching and buffering

Distinguish between caching and buffering The failure model defines the ways in which failure may occur in order to provide an understanding of the effects of failure. Give one type of failure with a brief description of the failure

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