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
Which computer can be used where there is no regular electricity?​
alina1380 [7]

Answer:

A mechanical computer

Explanation:

Created from gears and levers

7 0
2 years ago
Data silos are often associated with ________________.
amid [387]

Answer:

Option b the development of one or a few related analytics applications.

Explanation:

Data silo is the isolated information in an organization which is not shared across different departments. Data silo could exist because one department in an organization may not see the necessity to share information to other department. Or the information is deemed as unique data which is dedicated  to develop one or a few very specific analytics applications.  Data silos should be minimized if an organization intends to develop a data analytics system that support in enterprise wide level.

7 0
3 years ago
This speaker could be an instructor, a politician on the television, or even a radio or television commercial. What barriers wer
Shkiper50 [21]

Answer:

Electromagnetic interference and noise from the transmitting or receiving device.

Explanation:

Communication involves four processes, they are; encoding, sending, decoding, and feedback. A message, during this process of communication, can be altered, this is known as noise.

Telecommunication is simply communication between long distances. The effect of noise is more pronounced and can be noticed by listeners. These noises are produced by the transmitter and electromagnetic signals or waves of other transmitting devices.

6 0
3 years ago
________ speeds time to insights and enables better data governance by performing data integration and analytic functions inside
Lyrx [107]
<h3><em>↓Answer↓</em></h3>

<u>In-database analytics</u> speeds time to insights and enables better data governance by performing data integration and analytic functions inside the database.

3 0
2 years ago
(Game Design) Game Freak, the creators of Pokemon, are an example of a(n):
bixtya [17]
D. Indie developer. Independent video game development, or indie game development, is the video game development process of creating indie games; these are video games, commonly created by individual or small teams of video game developers and usually without significant financial support of a video game publisher or other outside source.
7 0
3 years ago
Other questions:
  • Are mobile phones hazardous to your health?
    13·2 answers
  • Readability is the level of vocabulary used on the page. True or false
    8·1 answer
  • Using PowerPoint or Impressed guarantees that your presentation will do which of the following?
    6·1 answer
  • When searching the web software programs called fetch a few web pages and then they follow the links on those pages and fetch th
    9·2 answers
  • ____ is a bundled set of communications services, including internet, telephone, and tv, that operates over a total fiber-optic
    5·1 answer
  • Before a program written in c can be executed on a computer, what step is required to be done first?
    7·1 answer
  • You implement basic version control and go through the phase of creating a local repository. Initiate the commands to set up tha
    7·1 answer
  • The welcome screen of the program 123D consists of ___
    15·1 answer
  • How to use access?<br> like working in access and bringing tables and stuff
    5·1 answer
  • How did the tropica cyclone impact the environment​
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!