Question

Requriements: Submit only the files requested Print all floats to 2 decimal points unless stated otherwise...

Requriements:
Submit only the files requested
Print all floats to 2 decimal points unless stated otherwise

Descripition :
For this problem you will be implementing a Caesarin Cipher. A Caesarin Cipher takes a string and a shift amount and shift the characters in the string by the shift amount.

Specifications:
Only characters should be ciphered
If a character is shifted beyond the end of the aphabet it should wrap back around
For example if the letter 'y' is shifted 3 it will become 'b'
You will find the functions chr and ord very helpful for this assignment
ord takes in a single character and gives back its ascii value
ord('a') is 97
ord('B') is 66
chr takes an integer number and gives back the character it represents
chr(97) is 'a'
chr('B') is 66
Combining these ideas together
chr(ord('a') + 2) is 'c'
chr(ord('B') + 3) is 'E'

Assumptions:
Input will not always be valid
If invalid input is received your program should continue to ask for more input until a valid value is entered
While input may be invalid it will always be of the correct type
Valid Input:
Shift amount: a value between 0 and 25
String to be ciphered: any string is valid

Example 1
Please enter a string to be ciphered: abcXYZ
Please enter a shift amount between 0 and 25: 1
bcdYZA

Example 2
Please enter a string to be ciphered: ABCxyz 123
Please enter a shift amount between 0 and 25: 3
DEFabc 123

media%2Ff2e%2Ff2e5da07-0e37-484c-8f4d-cd
0 0
Add a comment Improve this question Transcribed image text
Answer #1

the c++ program is

#include <iostream> #include using namespace std; 1 <string> 3 4 6 7 int cheaks (string str, int n) int i; for i-ej i< str.leCAUsers staff Documents cea.exe Please enter a string to be ciphered :Uital Please enter a shift amount between and 25:5 Give37 38 int main) string strj int n,V j 40 do cout«c\n Please enter a string to be ciphered :; cin>>str; cout«c\n Please ent

Add a comment
Know the answer?
Add Answer to:
Requriements: Submit only the files requested Print all floats to 2 decimal points unless stated otherwise...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • You will be writing a simple Java program that implements an ancient form of encryption known...

    You will be writing a simple Java program that implements an ancient form of encryption known as a substitution cipher or a Caesar cipher (after Julius Caesar, who reportedly used it to send messages to his armies) or a shift cipher. In a Caesar cipher, the letters in a message are replaced by the letters of a "shifted" alphabet. So for example if we had a shift of 3 we might have the following replacements: Original alphabet: A B C...

  • In C please : The tasks in this exam review exercise are structured in levels. You...

    In C please : The tasks in this exam review exercise are structured in levels. You can see the point distribution for the levels at the end. It is strongly recommended that you ensure you have passed all test cases of lower levels before moving up to a higher level. For example, ensure you have completed all Level 0 and 1 tasks before even looking at Level 2 Tasks. MESSAGE ENCODER LEVEL 0: (test cases - 50 points) Start by...

  • Computer Science C++ Help, here's the question that needs to be answered (TASK D): Task D....

    Computer Science C++ Help, here's the question that needs to be answered (TASK D): Task D. Decryption Implement two decryption functions corresponding to the above ciphers. When decrypting ciphertext, ensure that the produced decrypted string is equal to the original plaintext: decryptCaesar(ciphertext, rshift) == plaintext decryptVigenere(ciphertext, keyword) == plaintext Write a program decryption.cpp that uses the above functions to demonstrate encryption and decryption for both ciphers. It should first ask the user to input plaintext, then ask for a right...

  • In C++ please! Please include .cpp and .hpp files! Thank you! Recursive Functions Goals Create and...

    In C++ please! Please include .cpp and .hpp files! Thank you! Recursive Functions Goals Create and use recursive functions In this lab, we will write a program that uses three recursive functions. Requirements: Important: You must use the array for this lab, no vectors allowed. First Recursive Function Write a function that recursively prints a string in reverse. The function has ONLY one parameter of type string. It prints the reversed character to the screen followed by a newline character....

  • write a code on .C file Problem Write a C program to implement a banking application...

    write a code on .C file Problem Write a C program to implement a banking application system. The program design must use a main and the below functions only. The program should use the below three text files that contain a set of lines. Sample data of these files are provided with the assessment. Note that you cannot use the library string.h to manipulate string variables. For the file operations and manipulations, you can use only the following functions: fopen(),...

  • The following are screen grabs of the provided files Thanks so much for your help, and have a n...

    The following are screen grabs of the provided files Thanks so much for your help, and have a nice day! My Java Programming Teacher Gave me this for practice before the exam, butI can't get it to work, and I need a working version to discuss with my teacher ASAP, and I would like to sleep at some point before the exam. Please Help TEST QUESTION 5: Tamagotchi For this question, you will write a number of classes that you...

  • C++ please use only easy code and stdio.h because im just a beginner Description Write the...

    C++ please use only easy code and stdio.h because im just a beginner Description Write the program that can manage the information of students as follows: S 1. This program has two phase; the input phase and the output phase. 2. In an input phase, a teacher inputs the information (name, score, and department) for each student. The total number of students who can be inputted should be defined as a NUM OF_STUDENT constant value. In this example, the value...

  • Assignment You will be developing a speeding ticket fee calculator. This program will ask for a t...

    Assignment You will be developing a speeding ticket fee calculator. This program will ask for a ticket file, which is produced by a central police database, and your program will output to a file or to the console depending on the command line arguments. Furthermore, your program will restrict the output to the starting and ending dates given by the user. The ticket fee is calculated using four multipliers, depending on the type of road the ticket was issued: Interstate...

  • I have written my code for an employee management system that stores Employee class objects into...

    I have written my code for an employee management system that stores Employee class objects into a vector, I am getting no errors until I try and compile, I am getting the error: C2679 binary '==': no operator found which takes a right-hand operand of type 'const std::string' (or there is no acceptable conversion). But I am not sure why any help would be great, Thank you! 1 2 3 4 5 6 7 8 9 10 11 12 13...

  • For a C program hangman game: Create the function int play_game [play_game ( Game *g )]...

    For a C program hangman game: Create the function int play_game [play_game ( Game *g )] for a C program hangman game. (The existing code for other functions and the program is below, along with what the function needs to do) (Also the link to program files (hangman.h and library file) is below the existing code section. You can use that to check if the code works) What int play_game needs to do mostly involves calling other functions you've already...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT