Computer Science Canada

Turing Help (urgent)

Author:  MikeAlexnder [ Tue Dec 23, 2008 1:18 pm ]
Post subject:  Turing Help (urgent)

How do I create menus and submenus so when the user is in a submenu they can go back to the main menu if they want?

Author:  MikeAlexnder [ Tue Dec 23, 2008 1:19 pm ]
Post subject:  RE:Turing Help (urgent)

PLEASE HELP ME!

Author:  MikeAlexnder [ Tue Dec 23, 2008 1:22 pm ]
Post subject:  RE:Turing Help (urgent)

My code is like this right now:
Turing:
put "dssdsdsds"
put "1=3443434"
put "2=dsadasdas"
var option: int
get option
case option of
label 1 : put "dsadasdas"
            var option2:int
             get option2
             case option2 of
          label 1:32323232
          label 2: 4343434343
label 2: put fdsfsfsdfsd


Mod Edit: Remember to use syntax tags! Thanks Smile
code:
[syntax="turing"]Code Here[/syntax]

Author:  OneOffDriveByPoster [ Tue Dec 23, 2008 1:42 pm ]
Post subject:  Re: Turing Help (urgent)

MikeAlexnder @ Tue Dec 23, 2008 1:18 pm wrote:
How do I create menus and submenus so when the user is in a submenu they can go back to the main menu if they want?
You can use a loop. Have an option on each submenu for going back to the main menu. If the user chooses that option, make the code go back to the top of the loop where the main menu is.

Author:  DanielG [ Tue Dec 23, 2008 6:18 pm ]
Post subject:  RE:Turing Help (urgent)

easiest way is to use procedures, make each menu a procedure and when you choose something in a menu, it can just call any of the other menus (or if going back to a previous one, just use return)

Author:  Insectoid [ Tue Dec 23, 2008 6:58 pm ]
Post subject:  RE:Turing Help (urgent)

you made 3 posts in the same thread in under 4 minutes. 'bumping' is not allowed on compsci, especially 1 minute from the original post.

Author:  MikeAlexnder [ Tue Dec 23, 2008 7:05 pm ]
Post subject:  RE:Turing Help (urgent)

Can you shoew me how?

Author:  syntax_error [ Tue Dec 23, 2008 10:21 pm ]
Post subject:  Re: Turing Help (urgent)

code:

proc foo
/* magic code here */
end foo

proc bar
/* magical-er code here */
end bar

proc blag
/* magical-er-er code here */
end blag

loop
 put "foo"
 put "bar"
 put "blag"
 get choice
  if choice ==1
   cls
   loop
   bar
     exitcommand == true then exit
   end loop   
 
  else if choice == 2

   cls
   loop
   blag
     exitcommand == true then exit
   end loop

  else if choice == 3

   cls
   loop
   foo
     exitcommand == true then exit
   end loop

  end if

  end loop
 
end loop






Just a outline.

Note: not to scale.

Author:  Insectoid [ Wed Dec 24, 2008 10:55 am ]
Post subject:  RE:Turing Help (urgent)

Okay, so the main menu is in a loop. When you click a button, it goes to that menu's procedure, which contains a loop. When you click 'back', it exits that loop, which will then return to the main menu.

syntax_error, in Turing comparisons are done with a single = rather than ==. Just pointing it out Razz.

Turing:

proc menu1
    loop
        %mouse stuff
        exit when exitButton clicked
    end loop
end menu1

proc menu2
    %same as menu1, but with different options
end menu2

%main menu
loop
    if menu1 button clicked then
        menu1
    elsif menu2 button clicked then
        menu2
    end if
end loop

Author:  MikeAlexnder [ Wed Dec 24, 2008 1:02 pm ]
Post subject:  RE:Turing Help (urgent)

Can you help me edit my program so it will be in this form? If anyone can than I will send you my program or post it. My program is done and fuctional I just need to put in in the form above. I tried but I failed Crying or Very sad

Author:  Insectoid [ Wed Dec 24, 2008 1:05 pm ]
Post subject:  RE:Turing Help (urgent)

Nope. That's called 'thinking'. It's a huge part of programming.

Author:  MikeAlexnder [ Wed Dec 24, 2008 1:06 pm ]
Post subject:  RE:Turing Help (urgent)

PLEASE!!!I BEG YOU!!!!

Author:  S_Grimm [ Wed Dec 24, 2008 1:18 pm ]
Post subject:  RE:Turing Help (urgent)

1) Caps Lock should be off when typing
2) We don't do work for you. We will point you in the right direction and give you samples, but never will we write the code for you. EVER.

3) The Code is in this thread. Just take a look. Think about how to do it, then implement it. Don't worry if it doesn't work at first, just trouble shoot it untill you get it to work.

4) If / Else constructs

Author:  MikeAlexnder [ Wed Dec 24, 2008 8:07 pm ]
Post subject:  RE:Turing Help (urgent)

It doesn't work!!!!

Author:  Insectoid [ Wed Dec 24, 2008 8:35 pm ]
Post subject:  Re: RE:Turing Help (urgent)

AV @ Wed Dec 24, 2008 1:18 pm wrote:
The Code is in this thread. Just take a look. Think about how to do it, then implement it. Don't worry if it doesn't work at first, just trouble shoot it untill you get it to work.


If it doesn't work, you haven't done this.

Author:  DanielG [ Wed Dec 24, 2008 10:23 pm ]
Post subject:  RE:Turing Help (urgent)

Also, if you get some sort of error you don't understand, or you don't understand why a specific thing you wrote isn't working, you can repost your code and someone could help you

Author:  TheGuardian001 [ Wed Dec 24, 2008 11:27 pm ]
Post subject:  Re: Turing Help (urgent)

Abbreviating swearwords is more likely to get people to ignore you than help you. There have been multiple ideas posted that will work in this situation. if you just use their suggestions you should be able to figure this out.

Personally, I would go with the procedures.

code:

proc menu1()
    %contents
    loop
        exit when whatever
    end loop
end menu1
proc menu2()
%more contents!
    loop
        exit when whatever
    end loop
end menu2
proc menu3()
%EVEN MORE CONTENTS!
    loop
        exit when whatever
    end loop
end menu3

proc mainMenu()
    put "option1"
    put "option2"
    put "option3
    get choice
    if choice was 1
        menu1
    elsif choice was 2
        menu2
    elsif choice was 3
        menu3
    end if
end mainMenu

loop
mainMenu
end loop


This is essentially a working solution! you just need to put it into Turing and put in menu contents! not only is this a working solution, but TWO other people have already posted almost the exact same thing. when you ask for help, actually read the advice people give you! then you can solve the problem on your own!


: