I am now learning to create functions. I have read the tutorial on this site and several others. I have not been able to find any guidance though as to how to creat a function that returns a menu. The menu is basic:

notice the return type is void, so it wont return anything as you know. if you just want the function to display the menu, then your done, and you can take care of the user input in your calling function.

however, as youll notice the comments, i think it would be better to include the user input code inside the function (changing the function name to suit the functions task of course). if this is the case, youll need to add in a few things, note my comments, and change the function's signature. more specifically, the functions return type.

edit:
and if both of these arent what your looking for, you can create a string with the above as its contents, and return that. this would return a 'menu', i guess. also it would be completely pointless!

hope it helps.

01-15-2008

King Mir

Well the easiest thing to do would be to just put the above code in a function:

You call get_menu and have declared a get_menu function but implemented a getmenu function.

01-16-2008

Elysia

You need to learn how to interpret linking errors.
"unresolved external symbol" means the linker was unable to find a function or a variable.
"void __cdecl get_menu(void)" says it couldn't find "void get_menu()". So where in your code is get_menu? I don't see it, do you? All I see it getmenu!

01-16-2008

got1sleeve

Quote:

Originally Posted by Elysia

You need to learn how to interpret linking errors.
"unresolved external symbol" means the linker was unable to find a function or a variable.
"void __cdecl get_menu(void)" says it couldn't find "void get_menu()". So where in your code is get_menu? I don't see it, do you? All I see it getmenu!

I'm kind of teaching myself and learning from you all but i see what you're saying about the error that makes sense once its explained haha but to a noob just reading that it looks like swahili

01-17-2008

Elysia

I know it does. VC++ is horrible on linking errors, but once you get it explained to you, you can start interpreting them on your own. Good luck on that.