Question: Write a C + + program ex 3 _ stringArray.cpp with the following code in the Visual Studio project or copy the following code into

Write a C++ program ex3_stringArray.cpp with the following code in the Visual Studio project or copy the following code into your IDE:
1
#include
2
#include
3
4
using namespace std;
5
6
//ADD CODE: Add prototypes for the unmix and decipher functions here
7
8
int main()
9
{
10
string code ="K*@*R*S*\037*D*W*D*Q*B*H*R*D*";
11
cout << "Step 0: "<< code << endl;
12
13
string unmixed;
14
unmixed = unmix(code);
15
cout << "Step 1: "<< unmixed << endl;
16
17
decipher(unmixed);
18
cout << "Step 2: "<< unmixed << endl;
19
20
return 0;
21
}
22
23
//Function unmix:
24
// Returns a new string containing
25
// only the even characters of string s
26
string unmix(string s)
27
{
28
string ret;
29
for (int i =0; i < s.length(); i++)
30
{
31
//ADD CODE: if i is even
32
33
{
34
//COMPLETE LINE: add the character at i onto ret
35
ret +=
36
}
37
}
38
return ret;
39
}
40
41
//Function decipher:
42
// Implements a Caesar Cipher decoder
43
// every character in s will have 1 added on to its value
44
void decipher(string &s)
45
{
46
//ADD CODE: Write a for loop to that counts i from 0 to the length of string s
47
48
{
49
s[i]= s[i]+1;
50
}
51
}
Complete this program by following the comments in the code.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!