View the step-by-step solution to:

Why would something like this not work for a simple yes/no to continue?

Why would something like this not work for a simple yes/no to continue? This is only a portion of the code, but doing this it just keeps looping asking for yes or no over and over no matter what the user inputs. I'm trying to get it to just ask the user to choose yes or no again if they don't press 'y' or 'n'.


   do

   {

      printf("Do you want to enter a middle initial(s)? (y or n): ");

      scanf("%s", &prompt);


   } while (prompt != 'y' || prompt != 'Y' || prompt != 'n' || prompt != 'N');


   if (prompt == 'y' || prompt == 'Y')

   {

      printf("Please enter the contact's middle initial(s): ");

Top Answer

Please try this #include <stdio.h> int main () {    char prompt;    do   {     printf ( "Do you want... View the full answer

Sign up to view the full answer

Why Join Course Hero?

Course Hero has all the homework and study help you need to succeed! We’ve got course-specific notes, study guides, and practice tests along with expert tutors.

-

Educational Resources
  • -

    Study Documents

    Find the best study resources around, tagged to your specific courses. Share your own to gain free Course Hero access.

    Browse Documents
  • -

    Question & Answers

    Get one-on-one homework help from our expert tutors—available online 24/7. Ask your own questions or browse existing Q&A threads. Satisfaction guaranteed!

    Ask a Question
Ask a homework question - tutors are online