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
stepan [7]
3 years ago
6

Sentence Deobfuscate Name this file deobfuscate.cpp Hints: Don’t overthink this problem. Prompt the user to enter a collection o

f sentence words (i.e., words in the sentence), with the spaces removed (i.e., the obfuscated sentence) and with words that are less than ten (10) letters each. Then prompt the user to enter a sequence of numbers that represent the length of each corresponding sentence word (i.e. the deobfuscated details). Output the deobfuscated sentence. Convert char c to int by subtracting 48 (‘0’) from c.
Sample Execution:
Please enter obfuscated sentence: Thisisasentence
Please enter deobfuscation details: 4218
Deobfuscated sentence: This is a sentence
Computers and Technology
1 answer:
nordsb [41]3 years ago
7 0

Answer:

In C++:

#include <iostream>

using namespace std;

int main(){

   string text,lengt;

   cout<<"Please enter obfuscated sentence: ";    cin>>text;

   cout<<"Please enter deobfuscation details: ";    cin>>lengt;

   string t1, t2;

   int kount = 0;

   for(int i = 0;i<lengt.length();i++){

   kount+=(int)(lengt[i]-'0');

   t1 = text.substr(0, kount);

   t2 = text.substr(kount, text.length()-1);

   text = t1 +" "+ t2;

   kount++;   }

   cout<<"Deobfuscated sentence: "<<text;

   return 0; }

Explanation:

This declares the text and the deobfuscation details as string

   string text,lengt;

This prompts for the sentence

   cout<<"Please enter obfuscated sentence: ";     cin>>text;

This prompts for the details

   cout<<"Please enter deobfuscation details: ";     cin>>lengt;

t1 and t2 are declared as string. They are used to split the texts into 2 parts

   string t1, t2;

This declares and initializes a count variable to 0  

   int kount = 0;

This iterates through the deobfuscation details

for(int i = 0;i<lengt.length();i++){

This gets each deobfuscation character

   kount+=(int)(lengt[i]-'0');

The next two instructions splits the text into 2

This gets from 0 to kount.

   t1 = text.substr(0, kount);

This gets from kount to the last index

   t2 = text.substr(kount, text.length()-1);

The new string or sentence is calculated here

   text = t1 +" "+ t2;

The kount variable is incremented by 1

   kount++;   } The loop ends here

This prints the new sentence

   cout<<"Deobfuscated sentence: "<<text;

<em>See attachment for program file</em>

Download cpp
You might be interested in
Samantha was calculating a mathematical formula on an electronic spreadsheet. She used multiple values to recalculate the formul
Bezzdna [24]
<span>Random access memory. This problem requires you to know what the different types of memory are and their relative advantages and disadvantages. Let's look at them and see why 3 are wrong and one is correct. read-only memory: Otherwise known as ROM, this type of memory stores code that can't be over written. Used frequently for constant lookup values and boot code. Since it can't be written to by normal programs, it can't hold temporary values for Samantha. So this is the wrong choice. random-access memory: Otherwise known as RAM, this type of memory is used to store temporary values and program code. It is quite fast to access and most the immediately required variables and program code is stored here. It can both be written to and read from. This is the correct answer. hard disk: This is permanent long term readable and writable memory. It will retain its contents even while powered off. But accessing it is slow. Where the contents of RAM can be accessed in nanoseconds, hard disk takes milliseconds to seconds to access (millions to billions of times slower than RAM). Because it's slow, this is not the correct answer. But it's likely that Samantha will save her spreadsheet to hard disk when she's finished working with it so she can retrieve the spreadsheet later to work on again. compact disk: This is sort of the ROM equivalent to the hard disk. The data stored on a compact disk can not be over written. One way of describing the storage on a compact disk is "Write Once, Read many times". In most cases it's even slower than the hard disk. But can be useful for archiving information or making backups of the data on your computer.</span>
5 0
4 years ago
Read 2 more answers
If the number 30 is in a cell, what number will be displayed after you format the cell in percent format? 30% 3000% 300% .003%
stellarik [79]
30% i believe im not sure im trying to complete a challenge honestly lol

5 0
3 years ago
Marta, an art director, wants to give feedback to her graphic designer on his logo design. To be effective her feedback should b
Lana71 [14]

Answer:

B. Specific and provided during the construction of the project, and the end of the project.

Explanation:

The feedback have to be specific and provided during the construction of the project, and at the end of the project.

8 0
3 years ago
Read 2 more answers
3. Of the following pieces of information in a document, for which would you most likely insert a mail merge field? A. First nam
lara [203]
I would suggest the answer would be both A and D, mail merge is used to specify different field for different recipients. 
8 0
4 years ago
Read 2 more answers
A baseball diamond has an area of 3,600 square feet. What is the distance between each base? How far will a runner run around th
Ksju [112]
Also ~ how far does a runner run around the bases on a home run? It's explained in my answer. lw = sa (length times width = surface area) So multiplying length by width (since they're the same in this case you're squaring the length or squaring the width - no difference) You'll get 3600 feet.
6 0
4 years ago
Other questions:
  • In the two-level directory, if a user refers to a particular file then__________________ Select one: a. only his/her own UFD (us
    7·1 answer
  • Obtain the 10’s complement of the following six-digit decimal numbers:<br><br> 123900<br><br> 980657
    10·1 answer
  • The central device on a network that provides a common connection point for nodes on that network is called the
    8·1 answer
  • What are some programs that you have used that have condition-controlled loops and count-controlled loops?
    10·1 answer
  • You don't have policies that force settings for the look of users' computer desktops. Each user's chosen desktop settings are ap
    15·2 answers
  • Write a program that reads integers from the user and stores them in a list. Your
    15·1 answer
  • Chris is a project manager. He would like to schedule a status meeting for the next week. Several of the group members work at a
    12·1 answer
  • In which of the following cases is the application of a nested loop not justified? When comparing two lists of integers When for
    14·1 answer
  • Cookie Snooping
    14·1 answer
  • What is the most important person and why
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!