Thread: loops, menu loops

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    Mar 2010
    Posts
    41

    Unhappy loops, menu loops

    so this is my
    Code:
    }
    int c;
    {printf("To play blackjack press 1:");scanf("%d", &c);}
    if(c==1)
    do{
    printf("Here we go\n");
    break;
    }while(c==1);
    if(c!=1)
    do{
    printf("Please only press 1.\n");
    }while(c==1);
    
    return 0;
    }
    //after the choice for rules has been made what string do i need to use in order to have this snippet loop back to the top and have it run the scanf all over again? like if the user presses 2 i want it to loop back up so that they can keep having the chance to enter it again instead of just ending the program and having to run "a.out" again...help
    Last edited by gloworm; 04-11-2010 at 10:29 AM. Reason: had to put in my actual code!!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Poll event loop
    By rogster001 in forum C++ Programming
    Replies: 2
    Last Post: 09-17-2009, 04:28 AM
  2. need help with a loop
    By Darkw1sh in forum C Programming
    Replies: 19
    Last Post: 09-13-2009, 09:46 PM
  3. funny-looking while loop
    By Aisthesis in forum C++ Programming
    Replies: 3
    Last Post: 08-30-2009, 11:54 PM
  4. nested loop, simple but i'm missing it
    By big_brother in forum C Programming
    Replies: 19
    Last Post: 10-23-2006, 10:21 PM
  5. loop issues
    By kristy in forum C Programming
    Replies: 3
    Last Post: 03-05-2005, 09:14 AM