programmig help!

This is a discussion on programmig help! within the C++ Programming forums, part of the General Programming Boards category; the shipping clerk at rinky dooflingy company is faced with the following problem. dooflingies are very delicate and must be ...

  1. #1
    Registered User
    Join Date
    Jun 2004
    Posts
    1

    programmig help!

    the shipping clerk at rinky dooflingy company is faced with the following problem. dooflingies are very delicate and must be shiped in special containers. these containers are available in four sizes huge, large, medium, small, which can hold 50, 20, 5, and 1 dooflingies, respectively. write a program that reads the number of dooflingies to be to be shipped and print the number of huge, large, medium, and small containers needed to send shipment in the minimum nuber of containers and with the minimum amount of wasted space. use named constants for the number of dooflingies each type of container can. teh output should be similar to the following:

    huge 21; large 2; medium 1; small 3

  2. #2
    Registered User
    Join Date
    Jun 2004
    Posts
    14
    well im not gonna do your homework for you, but here is the basic idea....

    Code:
    void main()
    {
         int huge=0,large=0,medium=0,small=0,doofs=0;
         cin>>doofs;
         while(doofs>0)
         {
              if(doofs>50)
              {
                    huge++;
                    doofs-=50;
              }
             else if(doofs>20)
             {
                   large++;
                   doofs-=20;
              }
    //        etc....
         }
    }

    hope that helps... first time using the code block... hope it comes out right....

  3. #3
    Registered User
    Join Date
    Apr 2002
    Posts
    1,571
    dean is faced with the following problem. He has a homework assignment he's not sure how to do.

    Seriously, do you think someone is just going to write that for you? I'm not trying to be mean about it or anything but at least ask some specific questions so we know you attempted it. Better yet, show us the source from your attempt.
    "...the results are undefined, and we all know what "undefined" means: it means it works during development, it works during testing, and it blows up in your most important customers' faces." --Scott Meyers

  4. #4
    Anti-Poster
    Join Date
    Feb 2002
    Posts
    1,399
    Code:
    #include <iostream>
    
    int main()
    {
        std::cout << "huge 21; large 2; medium 1; small 3" << std::endl;
        return 0;
    }
    If I did your homework for you, then you might pass your class without learning how to write a program like this. Then you might graduate and get your degree without learning how to write a program like this. You might become a professional programmer without knowing how to write a program like this. Someday you might work on a project with me without knowing how to write a program like this. Then I would have to do you serious bodily harm. - Jack Klein

  5. #5
    Registered User
    Join Date
    Oct 2001
    Posts
    2,934
    >void main()
    void main() is wrong. See the FAQ for why:

    Programming FAQ

  6. #6
    Registered User
    Join Date
    Jun 2004
    Posts
    14
    My appologies all, i didnt realize giving someone a nudge on a hw assignment was so taboo... i will refrain from such nudges in the future...

    ~Craw

  7. #7
    Registered User
    Join Date
    Apr 2002
    Posts
    1,571
    Giving a nudge isn't bad usually. It's just that he directly copied and pasted the problem. I mean, he doesn't even type anything else. No greetings, no where do I start, nothing. That's just disrepectful if you ask me. It's as if he was expecting someone to jump at the chance to program that for him.
    "...the results are undefined, and we all know what "undefined" means: it means it works during development, it works during testing, and it blows up in your most important customers' faces." --Scott Meyers

  8. #8
    Hardware Engineer
    Join Date
    Sep 2001
    Posts
    1,398

    Welcome!

    Welcome to the board, dean.

    Please read the Homework Announcment. Programmers generally like the process of solving problems and puzzles, and we want you to enjoy the experience of finding a solution. So, ask questions like "How do I get started?", "I'm stuck on...", "I'm getting an error when I..."

    Programming is somewhat of a creative process. There is more than one solution to a programming assignment. Allow yourself plenty of time. You can easily spend a couple of hours writing a short program that would take less than 5 minuites to key-in, if you were just copying someone else's "answer".

    While you're at it, read the Forum Guidelines. You'll find some tips that will help you get better responses. i.e. Use descriptive subject lines... something more specific than "programming help".

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. socket programming
    By shraddha in forum Networking/Device Communication
    Replies: 3
    Last Post: 09-11-2005, 12:14 PM

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