CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Apr 2013
    Posts
    1

    Little Help with a program.

    Hey guys,

    I am currently really new to this and I am stuck on some programs and was wondering if anyone could help me with either or both of the program specifications bellow.

    1. Construct a class diagram that can be used to represent food items. A type of food can be classified as basic or prepared. Basic food items can be further classified as meat, fruit, veg or Grain. The services provide by the class should be the ability to enter data for new food, to change data for food and to display existing data about food.

    using this class definition write a main program to include a simple menu that offers the following choices:
    1. Add food
    2. Modify Food
    3. Delete Food
    4. Exit this menu

    2. Read a list of numbers from a file and then print them out in reverse order. State whether the list is palindromic or not.

    I know some people refuse to do code for other people so if that is the case, could anyone provide even sections of code or psuedocode or something because I have no idea what to do whatsoever. Any help will be much appreciated.

  2. #2
    VictorN's Avatar
    VictorN is online now Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,396

    Re: Little Help with a program.

    About homework:
    A special note about Homework
    We have an FAQ about homework questions. If your question is related to a homework assignment, then read this FAQ. It will help you, help yourself!
    Have you some ideas how you would perform this work on the paper?
    If not - then it doesn't make any sense to discuss about coding.
    Victor Nijegorodov

  3. #3
    2kaud's Avatar
    2kaud is offline Super Moderator Power Poster
    Join Date
    Dec 2012
    Location
    England
    Posts
    7,822

    Re: Little Help with a program.

    I have no idea what to do whatsoever
    Why not? How have you been learning c++ up to now - course? I doubt that your first c++ program is based upon coding c++ classes! So you have some previous c++ knowledge and presumably have produced some working c++ programs before now. So you should have some ideas as Victor said in post #2

    1) So have you produced the class diagram? As you are being asked to produce one, they must have been covered by the course from which you are learning. If you don't understand what been already covered in the course then you need to go back to your course notes and/or the tutor for clarification. Once you have produced the class diagrams and had an attempt at producing the c++ classes then if you post the code here we'll help you with suggestions without doing the work for you.

    2) If you don't know what is a palindromic list/number, try an internet search. There's plenty of good info available. If I was producing a program for this, I would use a STL vector class to hold the data and then use the reverse iterator to obtain values in reverse order. Again, if you are having problems with the c++ code post the code and we'll provide suggestions.

    If you do post code, please format and indent the code properly first and use code tags (Go advanced, select code then click '#').
    All advice is offered in good faith only. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/ and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!

    C++23 Compiler: Microsoft VS2022 (17.6.5)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured