Problem

This is a discussion on Problem within the C Programming forums, part of the General Programming Boards category; In this part of the lab, you must write a program in C that prints the temperature at equally spaced ...

  1. #1
    Registered User
    Join Date
    Feb 2009
    Posts
    1

    Problem

    In this part of the lab, you must write a program in C that prints the temperature at equally spaced points on a triangular plate.


    We assume that the triangular plate that is enclosed by the lines x = 0 and y = 0 and x + y =100. Start by sketching this region on a piece of paper. The temperature at a point (x,y) on this plate is given by:

    T(x,y) = sin( x + y ) e -(x+y)/100


    Your program must:

    print the temperature at points spaced 20 units apart in the x-direction (starting at x = 0 ) and 10 units apart in the y-direction (starting at y = 0)
    print the temperature to 5 decimal places in a field of width 9


    Here is the expected output given the specification provided above:

    -0.18628
    0.36347
    -0.44658 -0.18628
    0.38430 0.36347
    -0.16728 -0.44658 -0.18628
    -0.15914 0.38430 0.36347
    0.49946 -0.16728 -0.44658 -0.18628
    -0.73195 -0.15914 0.38430 0.36347
    0.74746 0.49946 -0.16728 -0.44658 -0.18628
    -0.49225 -0.73195 -0.15914 0.38430 0.36347
    0.00000 0.74746 0.49946 -0.16728 -0.44658 -0.18628


    Note that the first line of output above corresponds to the row y = 100 while the last line corresponds to y = 0.

    Write your program in such a way that the separation between points can be changed easily.


    You will find the following functions in the library math.h useful:

    double sin( double angle ); /* returns the sine of angle */

    double exp( double num ); /* returns e^num */


    Having some trouble with this problem..anyone have some ideas for a solution?

  2. #2
    CSharpener vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,452
    Having some trouble with this problem
    Show us your troubles... your code so far I mean, and explain your troubles
    The first 90% of a project takes 90% of the time,
    the last 10% takes the other 90% of the time.

  3. #3
    Registered User
    Join Date
    Dec 2006
    Location
    Canada
    Posts
    3,167
    Either profs like to copy assignments or this is an assignment from an intro to programming course for first year engineers that I took last term .

  4. #4
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,185
    Quote Originally Posted by cyberfish View Post
    Either profs like to copy assignments or this is an assignment from an intro to programming course for first year engineers that I took last term .
    I don't see why it can't be both.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Need help understanding a problem
    By dnguyen1022 in forum C++ Programming
    Replies: 2
    Last Post: 04-29-2009, 04:21 PM
  2. Memory problem with Borland C 3.1
    By AZ1699 in forum C Programming
    Replies: 16
    Last Post: 11-16-2007, 10:22 AM
  3. Someone having same problem with Code Block?
    By ofayto in forum C++ Programming
    Replies: 1
    Last Post: 07-12-2007, 08:38 AM
  4. A question related to strcmp
    By meili100 in forum C++ Programming
    Replies: 6
    Last Post: 07-07-2007, 02:51 PM
  5. WS_POPUP, continuation of old problem
    By blurrymadness in forum Windows Programming
    Replies: 1
    Last Post: 04-20-2007, 06:54 PM

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