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
Andrews [41]
3 years ago
15

Your mission is to read this uber-classified memo from the Grand Poobah of annan. Of course, it's in code, so you'll need to wri

te a program to decrypt your message. The code is set up so that for the nth element in the array, you will need to read its nth letter. (Ex: if pirates is in array position 0, then print letter 0 of the word, which = p. if gangway is in array position 4, then print letter 4 = w.) To accomplish this, your main function should do the following: a. Declare 4 separate arrays of strings called secrets1, secrets2, secrets3, & secrets4 and assign them the following values: secrets1: { "platypus", "plethora","trend", "croak","almost", "toaster" }; secrets2: _{ "fire", "seen","trend", "produce" }; secrets3: { "tiretread", "chains", "stern", "bed bug" }; secrets4: {"oracle", "stetson","mother", "stie", "twigrot" }; b. Call the function decode 4 times - once for each array variable (secrets1, secrets2, secrets3 & secreets4) from Step a. (You'll have to do this with 4 lines of code; you can't use a loop for it.) c. Write a void function called decode that will i. Accept an array of strings, and the integer array length as the parameters. ii. Read through each word in the array. If the word is in the nth position of the array, then print the nth letter for that word. (For array item 0, print the letter at position 0 in the word. For array item 1, print the letter at position 1 in the word...etc.) Print all of the letters from this array on one line. iii. Print a blank

Computers and Technology
1 answer:
Monica [59]3 years ago
7 0

Answer:

Following are the code to this question:

#include<iostream>//declaring header file

using namespace std;  

void decode(string* arr, int n)//defining a method decode

{

for(int i = 0; i < n; i++)//defining a loop for print value

{

cout << arr[i][i] << " "; // using print method to print ith letter of the string

}

cout << endl;//line break

}

int main()//defining main method

{

string secret1[] = {"platypus","plethora","trend","croak","almost","toaster"};//defining string arry and assign value

string secret2[] = {"fire","seen","trend","produce"};//defining string arry and assign value

string secret3[] = {"tiretread","chains","stern","bed bug"};//defining string arry and assign value

string secret4[] = {"oracle","stetson","mother","stie","twigrot"};//defining string arry and assign value

decode(secret1, 6);//calling method decode and pass string array and integer number

decode(secret2, 4);//calling method decode and pass string array and integer number

decode(secret3, 4);//calling method decode and pass string array and integer number

decode(secret4, 5);//calling method decode and pass string array and integer number

return 0;

}

output:

Please find the attachment.

Explanation:

In the above C++ language code, a method "decode" is declared that accepts a string array and an integer variable in its parameter, inside the method a for loop is declared, which is used "n" variable to print its i^{th} letter value in the given string value.  

In the main method,  4 string array "secret1, secret2, secret3, and secret4" is declared which assigns some value, and then we call the method "decode" and pass string array value and an integer value in its parameter.

You might be interested in
What's the best definition of financial literacy?
8090 [49]

Answer:

defines personal financial literacy as "the ability to use knowledge and skills to manage financial resources effectively for a lifetime of financial well-being.\

Explanation: thats it

5 0
3 years ago
________ is a programming language invented by netscape used to control the objects on an html page and handle interactions with
spayn [35]
The answer is JavaScript
5 0
3 years ago
What symbol does access use to the left of a record when it is currently being edited and is therefore locked so that other user
dedylja [7]

Answer: It is a non-existing keyword or symbol in access

Explanation:

8 0
2 years ago
(Java) Write a program that accepts a number of minutes and converts it both to hours and days. For example, 6000 minutes is 100
iogann1982 [59]
Import java.util.Scanner;
public class MinutesConversion {
private static Scanner inputDevice;
public static void main(String[] args) {
int minutes, hours;
float days; // float for decimal point

inputDevice = new Scanner(System.in);
System.out.println("Please enter minutes for conversion >> ");
minutes = inputDevice.nextInt();
hours = minutes / 60;
days = hours / 24.0f;


System.out.println(+ minutes + " minutes is " + hours + " hour(s) or" + days " days");
}
}
6 0
3 years ago
What is the difference between the Paste Special and Paste Link options?
kotegsom [21]
Paste Link lets you automatically update the referenced document.
8 0
4 years ago
Read 2 more answers
Other questions:
  • OBJECTIVE This project will familiarize you with the use of pthreads, pthread mutexes and pthread condition variables. Your prog
    9·1 answer
  • What are the latest technology in 2014
    11·1 answer
  • Given that it takes 0.08 ms to travel from one track to the next of a hard drive; that the arm is originally positioned at Track
    6·1 answer
  • What shoul i get, Airpods or a ps4 cooling fan ???
    7·2 answers
  • ____ is an approach to boundary spanning which results from using sophisticated software to search through large amounts of inte
    5·1 answer
  • A workstation’s user prefers KDE over GNOME. Which login manager can this user run to ensure direct login to KDE?
    5·1 answer
  • 14. Which of the following statements is true? A. The most secure email message authenticity and confidentiality isprovided by s
    11·1 answer
  • What is an overview of your opinion of Digital Etiquette? Do not look it up bc I will know!
    7·1 answer
  • Write your question here (Keep it clear and simple to get the best answer)
    13·2 answers
  • Would you rather be rich and unknown or famous and poor
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!