Set hasDigit to true if the 3-character passCode contains a digit.

Programming Logic & Design Comprehensive
9th Edition
ISBN:9781337669405
Author:FARRELL
Publisher:FARRELL
Chapter8: Advanced Data Handling Concepts
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
Set hasDigit to true if the 3-character passCode contains a digit.
345154.2174782.qx3zqy7
1 #include <iostream>
2 #include <string>
3 #include <cctype>
4 using namespace std;
6 int main() {
bool hasDigit;
string passCode;
8
9.
hasDigit = false;
cin >> passCode;
10
11
12
13
passCode
"abc";
%3D
14
15
hasDigit = isdigit (passCode.at(0)) II isdigit(passCode.at(1)
%3D
Run
Transcribed Image Text:Set hasDigit to true if the 3-character passCode contains a digit. 345154.2174782.qx3zqy7 1 #include <iostream> 2 #include <string> 3 #include <cctype> 4 using namespace std; 6 int main() { bool hasDigit; string passCode; 8 9. hasDigit = false; cin >> passCode; 10 11 12 13 passCode "abc"; %3D 14 15 hasDigit = isdigit (passCode.at(0)) II isdigit(passCode.at(1) %3D Run
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
Programming with Microsoft Visual Basic 2017
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:
9781337102124
Author:
Diane Zak
Publisher:
Cengage Learning