- #1
needOfHelpCMath
- 72
- 0
Set hasDigit to true if the 3-character passCode contains a digit.
Note: I cannot use loops.
Code:
#include <iostream>
#include <string>
#include <cctype>
using namespace std;
int main() {
bool hasDigit = false;
string passCode;
int valid = 0;
passCode = "abc";
if (hasDigit) {
cout << "Has a digit." << endl;
}
else {
cout << "Has no digit." << endl;
}
return 0;
}
Note: I cannot use loops.