CODE;
#include <stdio.h>
#include <iostream>
using namespace std;
// returns the encrypted text
string encrypt(string text, int s)
{
string result = "";
// traverse text
for (int i=0;i<text.length();i++)
{
// apply transformation to each
character
// Encrypt Uppercase letters
if (isupper(text[i]))
result +=
char(int(text[i]+s-65)%26 +65);
// Encrypt Lowercase letters
else
result += char(int(text[i]+s-97)%26
+97);
}
// Return the resulting string
return result;
}
// returns the decrypted text
string decrypt(string text, int s)
{
string result = "";
// traverse text
for (int i=0;i<text.length();i++)
{
// apply transformation to each
character
// decryptEncrypt Uppercase
letters
if (isupper(text[i]))
result +=
char(int(text[i]-s-65)%26 +65);
// decrypt Lowercase letters
else
result += char(int(text[i]-s-97)%26
+97);
}
// Return the resulting string
return result;
}
// Driver program to test the above function
int main()
{
string text="IHATECHEGG";
int s = 4;
cout << "Encrypt : " << text;
cout << "\nunsecured: " << text;
cout << "\nsecured: " << encrypt(text,
s);
cout<<"\n";
string ab=encrypt(text, s);
cout << "decrypt : " << ab;
cout << "\nunsecured: " <<ab;
cout << "\nsecured: " <<
decrypt(ab,s);
return 0;
}
output 2

Write a program in python or c++ that has two functions: Function one is called: _encrypt...
Please answer this python questions.Thank you! Question Two Write a program that calculates the amount of money a person would earn over a period of time if his or her salary is one penny the first day, two pennies the second day, and continues to double each day. The program should ask the user for the number of days. Display a table showing what the salary was for each day, and then show the total pay at the end...
1. Write a Python program, in a file called concat_strings.py, that includes the following functions: orderedConcat, a recursive function that takes two alphabetically-ordered strings and merges them, leaving the letters in alphabetical order. Note that the strings may be different lengths. a main method that inputs two ordered strings and calls the orderedConcat method to return a resulting merged, ordered string. Your main method should print the two input strings and the result. Note: You may not use any of...
Python Programing : Convert to binary - functions Write a program that takes in a positive integer as input, and outputs a string of 1's and 0's representing the integer in binary. For an integer x, the algorithm is: As long as x is greater than 0 Output x % 2 (remainder is either 0 or 1) x = x // 2 Note: The above algorithm outputs the 0's and 1's in reverse order. You will need to write a...
Write a Python function, called counting, that takes two arguments (a string and an integer), and returns the number of digits in the string argument that are not the same as the integer argument. Include a main function that inputs the two values (string and integer) and outputs the result, with appropriate labelling. You are not permitted to use the Python string methods (such as count(), etc.). Sample input/output: Please enter a string of digits: 34598205 Please enter a 1-digit...
IN PYTHON CODE
Question #1 Write a function capital that has one argument: strlist that is a list of non-empty strings. If each string in the list starts with a capital letter, then the function should return the value True. If some string in the list does not start with a capital letter, then the function should return the value False You may use any of the string functions that are available in Python in your solution, so you might...
I need help writing this function in python. Write a function that takes, as input and returns a dictionary where each string in L is a key and the vowels of the string are values. This function is called def dictVowel(L). sample input is ["one", "two", "three"] output will be {"one": "oe", "two": "o", "three": "ee"}
Python: Using chr() and ord() write a function called en_crypt() that takes into input a string and returns a new encrypted version of the input string. Example: "atwOta@0202" should return "fy|TyfE5757", then write a function de_crypt() so that "fy|TyfE5757" returns "atwOta@0202"
(Must be written in Python) You've been asked to write several functions. Here they are: yourName() -- this function takes no parameters. It returns a string containing YOUR name. For example, if Homer Simpson wrote this function it would return "Homer Simpson" quadster(m) -- this function takes a value m that you pass it then returns m times 4. For example, if you passed quadster the value 7, it would return 28. isRratedMovieOK(age) -- this function takes a value age...
Write a Python function called string_times that takes two parameters: a string and a number, and prints output in the following format: • string_times('Hi', 2) → 'HiHi' • string_times('Hi', 3) → 'HiHiHi' You MUST use a while loop in your solution.
1. Write a C++ program called Password that handles encrypting a
password.
2. The program must perform encryption as follows:
a. main method
i. Ask the user for a password.
ii. Sends the password to a boolean function called
isValidPassword to check validity.
1. Returns true if password is at least 8 characters long
2. Returns false if it is not at least 8 characters long
iii. If isValidPassword functions returns false
1. Print the following error message “The password...