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
my headphone jack that is like in the computer will not work only my speakers will work when i plug in
marusya05 [52]

I'm assuming that what you are saying is that while the headphone is plugged in to the computer, it still plays on the computer speakers.

Most likely, the headphone outlet is dirty and need cleaning. To solve this, plug in your headphones into the headphone outlet, and take it out really quickly. Do this for a certain amount of time until it works.

If this does not work, check the settings if you are allowing it to play into external devices or not.

~

3 0
3 years ago
Read 2 more answers
Which amendment discussed in the unit do you think has the greatest effect on your life? Why?
lora16 [44]
The 13th amendment (freed the slaves) for me because I am black
6 0
3 years ago
What is Geocortex and how does it work in web or mobile?
RoseWind [281]

Explanation:

Geocortex -

Geocortex mobile is the framework which is a native application for the different mobile OS such as iOS, Android, and Windows. It is built on the version of Esri’s ArcGIS Run time SDK for the .NET.

The Geocortex mobile Designer which is a browser-based configuration tool which is designed to simplify the experience combined with the Geocortex mobile, can make this the work leading framework and building the mobile offline apps on the Esri’s ArcGIS Run time .

The Geocortex mobile framework has many features which are building cutting-edge apps from the browser and optimizing the apps for mobile and also offline environments. We can also use the Geocortex Workflow for building the end-user interactions and also for any business process .

6 0
3 years ago
The benefits associated with software reuse are lower cost, better quality,
Sholpan [36]

Answer:

Software reuse is the technique through which updating the software system through the already defined components or assets of the software.This helps in increasing the productivity ,cost decrement , quality improvement etc.

But in actual case, the software reuse still persist high cost due to modification of inflexible designing of software .It also costs more than expected for the maintenance and training of software.

The security of the software is always at risk because of the usual and advanced hacking and attacking by the hackers even when the protect of software is high.Thus, these statements verify that the benefits of cost and security of software is not actually realized.

6 0
3 years ago
Given the following data definition
Mashcka [7]

Answer:

Array + 36.

Explanation:

The array contains the address of the first element or the starting address.So to find the address of an element we to add the size*position to the starting address of the array.Which is stored in the variable or word in this case.

There are 9 elements in the array and the size of integer is 4 bytes.So to access the last element we have to write

array + 4*9

array+36

4 0
3 years ago
Other questions:
  • The air in the atmosphere circulates mainly because _____.
    7·2 answers
  • An attempt to exploit a vulnerability of a computer or network component is the definition of ________.
    15·2 answers
  • When it comes to safety, the choice to be safe is often up to __________?
    8·1 answer
  • A bakery collects data on sales. Each sales record includes the date of the sale and some metadata about the items that were par
    11·1 answer
  • For your biology class, you have taken a number of measurements for a plant growth experiment. You wish to create a chart that s
    15·1 answer
  • What command would Emile use in his word processing software to insert a bar chart that will automatically adjust to changes mad
    6·2 answers
  • Each generation is set apart from the previous generation because of an innovation.
    6·1 answer
  • What is the primary purpose of source code editor features such as keyword hi lighting and auto-completion A.to speed up the cod
    7·1 answer
  • create a function that draws a certain number of spaces, followed by a certain number of stars, followed by a newline.
    6·1 answer
  • Help fast pleas. 3. How is this text formatted? (1 point)
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!