Thread: Void Function help

  1. #1
    Registered User
    Join Date
    Mar 2016
    Location
    Canada
    Posts
    1

    Void Function help


    down votefavorite
    Hello fellow programmers I am a programming student and this is my first year. Of course the majority of first year programmers have difficulties and need help. So I was wondering if you fellow programmers can help me with a part in my assignment. Specifically a void function that I need "help" with it is this:
    Write the following function to display a menu:
    void menu();This function takes no arguments and displays the following menu to the user. Please select from the following options:

    1. Display the inventory.
    2. Price check.
    3. Display my shopping cart.
    4. Add to cart.
    5. Remove from cart.
    6. Check out.
    7. Clear Screen.
    8. Exit.

    If you can tell me what logic to use or step by step or even maybe even give me hints or if you are extremely generous maybe complete it for me? wink wink it will be gratefully appreciated. Thanks in advance!

  2. #2
    Registered User
    Join Date
    Jun 2011
    Posts
    4,513
    Quote Originally Posted by Programming Boy View Post

    down votefavorite
    Hello fellow programmers I am a programming student and this is my first year. Of course the majority of first year programmers have difficulties and need help. So I was wondering if you fellow programmers can help me with a part in my assignment. Specifically a void function that I need "help" with it is this:
    Write the following function to display a menu:
    void menu();This function takes no arguments and displays the following menu to the user. Please select from the following options:

    1. Display the inventory.
    2. Price check.
    3. Display my shopping cart.
    4. Add to cart.
    5. Remove from cart.
    6. Check out.
    7. Clear Screen.
    8. Exit.

    If you can tell me what logic to use or step by step or even maybe even give me hints or if you are extremely generous maybe complete it for me? wink wink it will be gratefully appreciated. Thanks in advance!
    Well, I would point out that this is a cross-post, but you've already done this yourself.

    How To Ask Questions The Smart Way

    ... or if you are extremely generous maybe complete it for me? wink wink
    Please see the homework policy - we are here to assist with problems, not hand out solutions.

    Regarding your question - do you know how to write a function? Let's start there.

  3. #3
    Registered User
    Join Date
    Dec 2015
    Posts
    112
    Think about how to break this down into parts.

    1. How to display information to the user.
    2. How to get information from the user.
    3. Perform some logic based on this input.
    4. Keep a count, add items to the car.

  4. #4
    Registered User
    Join Date
    Dec 2015
    Posts
    68
    Calling something void-function show that you just started.

    void functionname (void); // prototype probably should be in the .h file, forward reference now possible.

    void functionname (void){
    The first void means that this function does not return anything, the second void means this function don't expect any incoming data.
    Last edited by tonyp12; 03-10-2016 at 05:10 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. control reaches end of non void function in bool function
    By Giwrgows x in forum C Programming
    Replies: 26
    Last Post: 12-19-2015, 02:58 PM
  2. difference between void and static void function
    By mahaju in forum C++ Programming
    Replies: 7
    Last Post: 12-27-2011, 04:02 AM
  3. Passing a variable in void to another void function
    By stevedawg85 in forum C++ Programming
    Replies: 5
    Last Post: 05-05-2006, 06:17 PM
  4. void, void function
    By Furious_George in forum C++ Programming
    Replies: 4
    Last Post: 10-14-2003, 05:04 PM
  5. void non void function
    By modance in forum C Programming
    Replies: 6
    Last Post: 01-28-2003, 08:06 AM

Tags for this Thread