Quick question about menu's

This is a discussion on Quick question about menu's within the C Programming forums, part of the General Programming Boards category; If I have a menu with some options how do i make the program return to the menu after performing ...

  1. #1
    Registered User
    Join Date
    May 2006
    Posts
    8

    Quick question about menu's

    If I have a menu with some options how do i make the program return to the menu after performing one of the options.

  2. #2
    Registered User whiteflags's Avatar
    Join Date
    Apr 2006
    Location
    United States
    Posts
    7,714
    Well the menu is in a loop right? Place continue after the options. Make sure the loop breaks when the user wants to exit the program!

  3. #3
    Registered User
    Join Date
    May 2006
    Posts
    8
    haha i'm dumb. Thanks a bunch

  4. #4
    Registered User
    Join Date
    Mar 2006
    Posts
    725
    You could place all the options in functions, and call the functions from the menu, always leaving the menu in global context.
    Code:
    #include <stdio.h>
    
    void J(char*a){int f,i=0,c='1';for(;a[i]!='0';++i)if(i==81){
    puts(a);return;}for(;c<='9';++c){for(f=0;f<9;++f)if(a[i-i%27+i%9
    /3*3+f/3*9+f%3]==c||a[i%9+f*9]==c||a[i-i%9+f]==c)goto e;a[i]=c;J(a);a[i]
    ='0';e:;}}int main(int c,char**v){int t=0;if(c>1){for(;v[1][
    t];++t);if(t==81){J(v[1]);return 0;}}puts("sudoku [0-9]{81}");return 1;}

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Very quick math question
    By jverkoey in forum A Brief History of Cprogramming.com
    Replies: 8
    Last Post: 10-26-2005, 11:05 PM
  2. very quick question.
    By Unregistered in forum C++ Programming
    Replies: 7
    Last Post: 07-24-2002, 03:48 AM
  3. quick question
    By Unregistered in forum C++ Programming
    Replies: 5
    Last Post: 07-22-2002, 04:44 AM
  4. Quick Question Regarding Pointers
    By charash in forum C++ Programming
    Replies: 4
    Last Post: 05-04-2002, 11:04 AM
  5. Quick question: exit();
    By Cheeze-It in forum C Programming
    Replies: 6
    Last Post: 08-15-2001, 05:46 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21