C++ Help LOOPS & STRINGS A website requires that passwords only contain numbers. For each character in secretStr that is not a number, replace the character with '1'. Ex: If the input is 9z0d72, then the output is: Updated password: 910172 Note: isdigit() returns true if a character is a digit, and false otherwise. Ex: isdigit('8') returns true. isdigit('a') false. Code provided to fix: #include #include using namespace std; int main() {    string secretStr;    unsigned int i;        cin >> secretStr;    /* Your code goes here */    cout << "Updated password: " << secretStr << endl;        return 0; }

EBK JAVA PROGRAMMING
8th Edition
ISBN:9781305480537
Author:FARRELL
Publisher:FARRELL
Chapter2: Using Data
Section: Chapter Questions
Problem 12PE
icon
Related questions
icon
Concept explainers
Question

C++ Help LOOPS & STRINGS

A website requires that passwords only contain numbers. For each character in secretStr that is not a number, replace the character with '1'.

Ex: If the input is 9z0d72, then the output is:

Updated password: 910172

Note: isdigit() returns true if a character is a digit, and false otherwise. Ex: isdigit('8') returns true. isdigit('a') false.

Code provided to fix:

#include <iostream>
#include <string>
using namespace std;

int main() {
   string secretStr;
   unsigned int i;
   
   cin >> secretStr;

   /* Your code goes here */

   cout << "Updated password: " << secretStr << endl;
   
   return 0;
}

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 2 images

Blurred answer
Knowledge Booster
Control Structure
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781305480537
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Programming with Microsoft Visual Basic 2017
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:
9781337102124
Author:
Diane Zak
Publisher:
Cengage Learning
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT