CHALLENGE3.16.2: Alphabetic replace.ACTIVITYReplace any alphabetic character with ' in 2-character string passCode. Ex: If passCode is "9a", output is:9Hint: Use two if statements to check each of the two characters in the string, using isalpha().1 #include 2 #include 3 #include 4 using namespace std;1 testpassed56 int main) {string passCode;All tests7passedcin passCode;10* Your solution goes here/1112cout << passCode << endl;return 0131415Run

Question
Asked Sep 30, 2019
173 views
CHALLENGE
3.16.2: Alphabetic replace.
ACTIVITY
Replace any alphabetic character with ' in 2-character string passCode. Ex: If passCode is "9a", output is:
9
Hint: Use two if statements to check each of the two characters in the string, using isalpha().
1 #include <iostream>
2 #include <string>
3 #include <cctype>
4 using namespace std;
1 test
passed
5
6 int main) {
string passCode;
All tests
7
passed
cin passCode;
10
* Your solution goes here
/
11
12
cout << passCode << endl;
return 0
13
14
15
Run
help_outline

Image Transcriptionclose

CHALLENGE 3.16.2: Alphabetic replace. ACTIVITY Replace any alphabetic character with ' in 2-character string passCode. Ex: If passCode is "9a", output is: 9 Hint: Use two if statements to check each of the two characters in the string, using isalpha(). 1 #include <iostream> 2 #include <string> 3 #include <cctype> 4 using namespace std; 1 test passed 5 6 int main) { string passCode; All tests 7 passed cin passCode; 10 * Your solution goes here / 11 12 cout << passCode << endl; return 0 13 14 15 Run

fullscreen
check_circle

Expert Answer

Step 1

Program:

//include the required header files

#include <iostream>

#include <string>

#include <cctype>

using namespace std;

 

//definition of main function

int main()

{

    //declare the variable

    string passCode;

 

    //get the input from the user

    cin >> passCode;

 

    //check the character in the string using "isalpha"

    if(isalpha(passCode[0]))

    {

        //set the character to the string

        passCode[0] = '_';

  &nb...

Want to see the full answer?

See Solution

Check out a sample Q&A here.

Want to see this answer and more?

Solutions are written by subject experts who are available 24/7. Questions are typically answered within 1 hour.*

See Solution
*Response times may vary by subject and question.
Tagged in

Engineering

Computer Science

Related Computer Science Q&A

Find answers to questions asked by student like you
Show more Q&A
add
question_answer

Q: In C++   Create a function called SuperRandomNumber. It should accept a number called top as the arg...

A: Note:The following program creates a function “SuperRandomNumber()” which accepts “top” as argument ...

question_answer

Q: Construct Turing machines that will accept the following languages on {a, b}: L = L (aaba*b).

A: Turing machine: Turing machine is a model of a hypothetical computing machine which can use a predef...

question_answer

Q: What exactly is Boolean?

A: BooleanBoolean also known as Boolean logic is actually a subset of algebra used for creating true or...

question_answer

Q: Explain in at least a paragraph what are considered pervasive security infrastructure risks

A: Pervasive security infrastructure refers to cloud security risks. As many users possibly from differ...

question_answer

Q: Write a complete C++ program that does the following:1. Create a 2-dimensional array with 8 rows and...

A: 1)Program plan:Declare the variables “rows” and “cols” as integerAssign “rows” to “8” and “cols” to ...

question_answer

Q: What are some apps you use regularly? Why? What makes you choose to use them over other apps that do...

A: There are many apps that we use regularly. The most commonly used apps includes the following:Educat...

question_answer

Q: Attached Files:  sample.txt (11.069 KB) You will only get one submission. I need a python prog...

A: Three counters are used to keep track of the running count of the words being read from the supplied...

question_answer

Q: Consider the following nested loop construct. Categorize its efficiency in terms of the variable n u...

A: Categorization of efficiency in terms of “n” using “big-o” notation:The statement “x*=2” is given in...

question_answer

Q: You have recently delivered the first phase of a mission-critical software intensive system. All of ...

A: Part 1: To simultaneously address the fix and continue with working on the second phase, one should ...