Thread: Need help with a C assignment due on 9/23 (Friday)

  1. #1
    Registered User
    Join Date
    Sep 2005
    Posts
    4

    Question Need help with a C assignment due on 9/23 (Friday)

    Hi I've never posted before on this board. (actually, I've just now signed up). But anyways; I need help with a homework assignment that will probably seem extremely easy to everyone here, I've never done any programming of any sort before so I was wondering if someone could show me how to do this.

    Thanks in advance,
    John Putnam

    The question:
    Write a program that takes the length and width of a rectangular yard and the length and width of a rectangular house situated in the yard. Your program should compute the time required to cut the grass at the rate of two square feet a second.

  2. #2
    C++ Developer XSquared's Avatar
    Join Date
    Jun 2002
    Location
    Ontario, Canada
    Posts
    2,718
    We're not going to write your code for you. If you're having trouble, post what you have, and we'll help you out.
    Naturally I didn't feel inspired enough to read all the links for you, since I already slaved away for long hours under a blistering sun pressing the search button after typing four whole words! - Quzah

    You. Fetch me my copy of the Wall Street Journal. You two, fight to the death - Stewie

  3. #3
    Registered User
    Join Date
    Sep 2005
    Posts
    4

    Unhappy thanks

    i will try to but like i said i dont even know how to start this. This is what I currently have done:

    /*Assignment 2
    Written By John Putnam
    September 2005
    */

    #include <stdio.h>
    int main<void>
    {
    printf<"Input Length of yard\n">;
    scanf< >;
    printf<"Input Width of yard\n">;
    scanf< >;
    printf<"Input Length of House\n">;
    scanf< >;
    printf<"Input Width of House\n">;
    scanf< >

    That's all I have I dont think its even close to being right, and I dont know how to proceed, this has taken me a week to get this far!!! PLEASE HELP!!!

  4. #4
    Registered User Tonto's Avatar
    Join Date
    Jun 2005
    Location
    New York
    Posts
    1,465
    It should not take you a week to do something like this. Surely, you have the internet, and potentially a good text and teacher at your fingertips. You are mixing up <> and () with function definitions/calls. Check out this very simple tutorial on the subject of console interaction: http://computer.howstuffworks.com/c7.htm

  5. #5
    Registered User
    Join Date
    Sep 2001
    Posts
    4,912
    Tonto - excellent tutorial recommendation!

    JohnnyBoy268 - please read the forum guidelines, located at http://cboard.cprogramming.com/annou...ouncementid=51. Please also refer to the sticky at the top of each forum concerning the proper way to post code.

    I hesitate to tell you that had you followed the guideline regarding searching the forums, you would have found how many other people are working on this same assignment.

  6. #6
    Registered User
    Join Date
    Sep 2005
    Posts
    29
    After that, you should find the area of both rectangles (the yard and the house) using the formula area = length * width . Then you need to subtract the area of the house from the area of the yard to get the total grass.

  7. #7
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,656
    > this has taken me a week to get this far!
    And now with less than 24 hours to go, you post a panic message saying "please help".

    > printf<"Input Length of yard\n">;
    Jeez, someone else used () to include a file, and now you're using <> to call a function.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Menu
    By Krush in forum C Programming
    Replies: 17
    Last Post: 09-01-2009, 02:34 AM
  2. please help..linked list homework assignment due tomorrow..
    By rocketman03 in forum C Programming
    Replies: 2
    Last Post: 11-23-2008, 06:32 PM
  3. Screwy Linker Error - VC2005
    By Tonto in forum C++ Programming
    Replies: 5
    Last Post: 06-19-2007, 02:39 PM
  4. Replies: 1
    Last Post: 10-27-2006, 01:21 PM
  5. need help with assignment due tonite
    By puckett_m in forum C Programming
    Replies: 4
    Last Post: 10-25-2001, 02:29 PM