Home / Expert Answers / Computer Science / read-in-a-3-character-string-from-input-into-variable-usercode-declare-a-boolean-variable-arealph-pa956

(Solved): Read in a 3-character string from input into variable userCode. Declare a boolean variable areAlph ...



Read in a 3-character string from input into variable userCode. Declare a boolean variable areAlphas and set areAlphas to tru

Read in a 3-character string from input into variable userCode. Declare a boolean variable areAlphas and set areAlphas to true if the first and second characters of userCode are both alphabetic characters. Otherwise, set areAlphas to false. Ex: If the input is \( h k 1 \), then the output is: Good passcode Note: Use getline(cin, userCode) to read the entire line from input into userCode. 1 #include 2 #include 3 #include 4 using namespace std; 5 6 int main() \{ 7 string userCode; \( 9 \quad 1 * \) Your code goes here */ 10 if (areAlphas) \{ \( 12 \quad \) cout \( \ll \) "Good passcode" \( \ll \) endl; \( 13 \quad\} \) 14 else \{ \( 15 \quad \) cout \( \ll \) "Bad passcode" \( \ll \) endl;


We have an Answer from Expert

View Expert Answer

Expert Answer


Code -: #include #include #include using namespace std; int main() { string userCo
We have an Answer from Expert

Buy This Answer $5

Place Order

We Provide Services Across The Globe