Thread: case ' ':

  1. #1
    Registered User
    Join Date
    May 2005
    Posts
    50

    case ' ':

    I have this problem, i want the case program to have a default where it restarts the case and waits for the input.

    like, case 'a':
    playgame();
    and then case 'a':
    restartcase // waits for another input.

    How do you restart case, (i'll printf a message saying thats not correct).


    thanks
    jay

  2. #2
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,897
    The only way to 'restart' a case is to use a loop.
    My best code is written with the delete key.

  3. #3
    Gawking at stupidity
    Join Date
    Jul 2004
    Location
    Oregon, USA
    Posts
    3,218
    Or you can use 'goto', but forget I said that.
    If you understand what you're doing, you're not learning anything.

  4. #4
    Registered User
    Join Date
    Oct 2001
    Posts
    2,934
    >Or you can use 'goto', but forget I said that.
    Can you provide an example?

  5. #5
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,897
    >Or you can use 'goto', but forget I said that.
    How would you use goto in such a way that it wouldn't be considered a loop?
    My best code is written with the delete key.

  6. #6
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    You could use recursion. That's not really a loop. Especially if you just run yourself out of stack space, or call exit when you're done.


    Quzah.
    Hope is the first step on the road to disappointment.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Segmentation fault!?!?!?
    By Viper187 in forum Windows Programming
    Replies: 57
    Last Post: 10-02-2008, 09:40 PM
  2. Format Precision & Scale
    By mattnewtoc in forum C Programming
    Replies: 1
    Last Post: 09-16-2008, 10:34 AM
  3. Base converter libary
    By cdonlan in forum C++ Programming
    Replies: 22
    Last Post: 05-15-2005, 01:11 AM
  4. Creating pop up menus
    By Ti22 in forum C++ Programming
    Replies: 22
    Last Post: 01-18-2005, 09:27 PM
  5. Binary Search Trees Part III
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 10-02-2004, 03:00 PM