1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
rjkz [21]
3 years ago
8

Write a program that encrypts and decrypts a string of characters. Use a char array for this, not the string class. The maximum

length of a string input to the program will be 200 characters. The input may contain blanks and other whitespace. Your program must request a c-string from the user and encrypt it as described below. If the user enters a single asterisk as the only thing on a line, the program should stop. Otherwise, encrypt the string, then display the encrypted version. Decrypt it using the inverse of the algorithm below and display the result. This should be the original string. Then go back and request another string.
Computers and Technology
1 answer:
dem82 [27]3 years ago
3 0

Answer:

C++ code for encryption is given below

Explanation:

#include <iostream>

using namespace std;

//functions to encrypt and decrypt

void encrypt(char str[]);

void decrypt(char str[]);

int main(){

char str[200];

bool done = false;

while(!done){

cout << "Enter a string (enter * to stop): ";

cin.getline(str, 200);

if(str[0] == '*' && str[1] == '\0')

done = true;

else{

encrypt(str);

cout << "Encrypted: " << str << endl;

decrypt(str);

cout << "Decrypted: " << str << endl;

}

cout << endl;

}

}

void encrypt(char str[]){

int i = 1;

for(int j = 0; str[j] != '\0'; j++){

str[j] += i;

i++;

if(i == 11)

i = 1;

}

}

void decrypt(char str[]){

int i = 1;

for(int j = 0; str[j] != '\0'; j++){

str[j] -= i;

i++;

if(i == 11)

i = 1;

}

}

You might be interested in
PLEASE HELP
Zinaida [17]

Answer:

B from you search question carefully and identify the key word

Explanation:

3 0
4 years ago
Read 2 more answers
The "Rudolph Rule" is best described by which of the following?
umka21 [38]

Answer:

B) Emphazizing certain points by using color.

Explanation:

I had the same question and I got it right. The answer is this because just like how Rudolph's nose and how it stands out from the others. And so if you pick only the important parts and add color then it will stand out.

7 0
3 years ago
1. Choose in each case that it affects which of the Information security requirements (confidentiality, integrity, availability)
just olya [345]

The  cases that it affects which of the Information security requirements is explained below.

<h3>What are the Information security violations of the above cases?</h3>

Someone has copied your credit card and CVV number has violated the confidentiality as this is to be known only by the owner for if the cvv is known by another person who is not the owner, it may lead to theft of the owners' funds/money.

If someone sends a message “Please come at 10 AM”, the receiver receives “Please come at 10.” and the person did miss the appointment due to the misinformation, it violates the availability. If one is not understanding a message, it is better to clarify so as to know if one will be available,

If the attacker has deleted the installed copy of the Microsoft Office application from your laptop is integrity/confidentiality. One who has integrity will not attack another's' system.

learn more about confidentiality from

brainly.com/question/863709

6 0
3 years ago
To use a jQuery UI widget, you must code two things in the way that’s prescribed for the widget. What are they?
Natasha2012 [34]

Answer:

the jQuery code and the jQuery UI selectors.

Explanation:

When we want to use jQuery UI widget we have to code two things and these are the jQuery code and the jQuery UI selectors. jQuery UI is a managed set of user interface(UI) effects,interactions,themes and widgets built on top of  JavaScript jQuery Library.

So we have to code the jQuery and the jQuery UI selectors.

3 0
3 years ago
The ____ allows a core to communicate with other cpu components, such as the memory controller and other cores
Gnoma [55]
The appropriate response is Bus Interface Unit or BIU. The BIU gives different capacities, including era of the memory and I/O addresses for the exchange of information between outside the CPU, and the EU. 
The EU gets program direction codes and information from the BIU, executes these guidelines, and store the outcomes in the general registers. By passing the information back to the BIU, information can likewise be put away in a memory area or kept in touch with a yield gadget. Note that the EU has no association with the framework transports. It gets and yields every one of its information through the BIU.
4 0
4 years ago
Other questions:
  • ​What file system below does not support encryption, file based compression, and disk quotas, but does support extremely large v
    10·1 answer
  • Spreadsheet software creates a ____, composed of a grid of columns and rows
    6·1 answer
  • In 2–4 sentences, describe how you would center text.
    11·1 answer
  • Write the definition of a function named newbie that receives no parameters and returns 1 the first time it is invoked (when it
    7·1 answer
  • A page-ranking algorithm ranks web pages according to
    15·2 answers
  • At the beginning of Section 5.2, it is stated that multiprogramming and multiprocessing present the same problems, with respect
    8·1 answer
  • PLSSS HELP!! During the late 20th century, immigration to the United States increased dramatically from
    7·1 answer
  • 4. Why does Hancock believe that our communication online is more honest than we might<br> expect?
    15·2 answers
  • When you get a new sim card do it come with a new number or do you have a activate the phone and get a new number in store ?
    9·1 answer
  • on early ethernet networks, all computers were connected to a single wire, forcing them to take turns on a local area network (l
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!