CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Dec 2003
    Posts
    2

    Temperature Reading & Conversion

    Hi all was hopin someone could help me with the following:

    Requirements:
    Write a skeleton program that reads the temperature froma temperature measuring device and didplays this in degrees centigrade or optionally farenheit on a user interface.

    Would be grateful if someone could give me code fot this.

  2. #2
    Join Date
    Apr 2002
    Location
    Los Angeles, Ca
    Posts
    238
    Clipper .. the purpose of this forum is NOT for us to do your homework for you, rather it is a place for you to ask questions on something that you are having trouble understanding or getting the proper results from.
    If anyone here did your homework for you ... what did you learn from it ... and what value is an A of F grade to us from an instructor we have no interaction with?

  3. #3
    Join Date
    Jun 2002
    Location
    Latvia, Riga
    Posts
    35
    Without doing your homework, I'll tell you this:

    To get the farenheit value, multiply the centigrade value by 1.8 and then add 32.

    Knowing that, you should be able to write the code easily. All you need to do is to create a formula for converting farenheit to Celsius, and write a few lines of code to handle the input/output. That should be an easy task.

  4. #4
    Join Date
    Nov 2003
    Location
    Seattle, WA
    Posts
    265
    To Convert Fahrenheit To Celsius: C = ( ( ( F - 32 ) / 9 ) * 5 )
    To Convert Celsius To Fahrenheit: F = ( ( ( C * 9 ) / 5 ) + 32 )

    But those are the formulas..

  5. #5
    Join Date
    Dec 2003
    Posts
    2
    Thanks for the help so far this is what I have come up with

    'var declaration
    Dim a, b As Double
    Dim c As String

    Private Sub Command1_Click()
    b = (a * 1.8) + 32
    Label1.Caption = "Howdy " + c + " the temperature is " & b
    End Sub
    'cleaning
    Private Sub Command2_Click()
    a = 0
    b = 0
    c = ""
    Label1.Caption = ""
    Text1.Text = ""
    Text2.Text = ""
    Text1.SetFocus
    End Sub

    think this should work but not sure. still confused about reading in from the temp device so any help would be appreciated

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