Ask Question
23 April, 21:10

Given a string variable s that has already been declared, write some code that repeatedly reads a value from standard input into s until at last a "Y" or "y"or "N" or "n" has been entered.

+5
Answers (1)
  1. 23 April, 23:09
    0
    The code to this question can be given as:

    Code:

    while ((s!="Y" && s!="y" && s!="N" && s!="n")) / /loop for check condition

    {

    cin >> s; / /insert value

    }

    Explanation:

    The description of the following code:

    In this code, we use a string variable s that has been to define in question. In code, we use a while loop. It is an entry control loop in loop we check variable s value is not equal to "y", "Y", "n" and "N". In the loop we use AND operator that checks all value together. If this is true So, we insert value-form user input in string variable that is "s".
Know the Answer?
Not Sure About the Answer?
Find an answer to your question ✅ “Given a string variable s that has already been declared, write some code that repeatedly reads a value from standard input into s until at ...” in 📘 Computers and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers