Menu

[solved] – Question 99431

Set hasDigit to true if the 3-character passCode contains a digit.
#include <iostream>
#include <string>
#include <cctype>
using namespace std;

int main() {
bool hasDigit;
string passCode;

hasDigit = false;
cin >> passCode;

/* Your solution goes here */

if (hasDigit) {
cout << “Has a digit.” << endl;
}
else {
cout << “Has no digit.” << endl;
}

return 0;
}

Expert Answer


OR


Leave a Reply

Your email address will not be published. Required fields are marked *