Set Hasdigit to True if the 3-Character Passcode Contains a Digit.

Set Hasdigit to True if the 3-Character Passcode Contains a Digit.

Question: Set Hasdigit to True if the 3-Character Passcode Contains a Digit.

Explanation:

#include <iostream>

#include <string>

#include <cctype>

using namespace std;

int main() {

bool hasDigit;

string passCode;

hasDigit = false;

passCode = “abc”;

/ Your solution goes here /

if (hasDigit) {

cout << “Has a digit.” << endl;

}

else {

cout << “Has no digit.” << endl;

}

return 0;

}

Answer:

if (isdigit(passCode.at(0)) || isdigit(passCode.at(1)) || isdigit(passCode.at(2)))

{

hasDigit = true;

}

Leave a Reply

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

escort -

eskisehir escort

- bet-park.net - bahispub.club -
lunabets.club
-

ligobet.link

-

gizabet.club

- ultrabetgiris.club -
pera-bet.com