Thread: Ignoramus needs help with a simple Lawmowing Program.

  1. #1
    Registered User
    Join Date
    Oct 2012
    Posts
    33

    Ignoramus needs help with a simple Lawmowing Program.

    Hey everyone, I need help with the next part of my homework. I'm trying to use scanf to read two values. The problem is the user input must match the assignment perfectly. As you can see the request for information requires both width and length placed after a single prompt. So how can I go about doing this? I have no clue where to start. Thanks!

    #9. Filename: grass.c “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.” The numbers are integers.
    [ssdavis@lect2 p1]$ grass.out
    Please enter the length and width of the yard > 100 95
    Please enter the length and width of the house > 45 38
    7790 square feet will take 64 minutes and 55 seconds to cut.
    [ssdavis@lect2 p1]$
    [ssdavis@lect2 p1]$ grass.out
    Please enter the length and width of the yard > 40 70
    Please enter the length and width of the house > 38 62
    444 square feet will take 3 minutes and 42 seconds to cut.
    [ssdavis@lect2 p1]$

  2. #2
    Registered User
    Join Date
    May 2009
    Posts
    4,183
    FAQ > How do I get a number from the user (C) - Cprogramming.com

    The last time I help you directly because there was no FAQ that would help.

    Read the FAQ and try to write the program.

    Tim S.
    "...a computer is a stupid machine with the ability to do incredibly smart things, while computer programmers are smart people with the ability to do incredibly stupid things. They are,in short, a perfect match.." Bill Bryson

  3. #3
    Registered User
    Join Date
    Jun 2011
    Posts
    4,513
    Please show your code so that we might offer insight into your plight.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Ignoramus needs help with a Simple Grade program.
    By Kurtanius21 in forum C Programming
    Replies: 7
    Last Post: 10-08-2012, 09:07 PM
  2. Simple program, simple problem
    By KAUFMANN in forum C Programming
    Replies: 5
    Last Post: 02-16-2011, 01:16 PM
  3. simple program, simple error? HELP!
    By colonelhogan44 in forum C Programming
    Replies: 4
    Last Post: 03-21-2009, 11:21 AM
  4. Simple program...simple problem?
    By deadherorising in forum C Programming
    Replies: 2
    Last Post: 03-12-2009, 08:37 PM
  5. Simple program, not so simple problem
    By nolsen in forum C++ Programming
    Replies: 2
    Last Post: 01-18-2008, 10:28 AM