Thread: Stuck on Measuring body fat

  1. #1
    Registered User
    Join Date
    Feb 2021
    Posts
    3

    Stuck on Measuring body fat

    Stuck on Measuring body fat-fatcal-jpgStuck on Measuring body fat-program-png
    Im having trouble with this project for class if anyone could help me out it would be
    Women Thirty Years and Younger hips + (.80 x thigh) – (2 x calf) – wrist = % body fat
    Women over Thirty hips + thigh – (2 x calf) – wrist = % body fat
    Men Thirty Years and Younger waist + (1/2 hips) – (3 x forearm) – wrist = % body fat Men over Thirty waist + (1/2 hips) – (2.7 x forearm) – wrist = % body fat
    Men Lean Body Mass (pounds) ÷ 0.85 = correct weight to be 15% fat
    Women Lean Body Mass (pounds) ÷ 0.78 = correct weight to be 22% fat
    Those are the formulas you have to use which i did but can I go to debug and insert numbers nothing happens. Could anyone help me out?


    https://paste.mod.gg/ujesohapiq.cs
    Last edited by kixify; 02-08-2021 at 11:59 AM.

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,656
    Copy and paste your code between [code][/code] tags.

    A fuzzy picture of barely legible text just doesn't cut it.
    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.

  3. #3
    Registered User
    Join Date
    Feb 2021
    Posts
    3
    Quote Originally Posted by Salem View Post
    Copy and paste your code between tags.

    A fuzzy picture of barely legible text just doesn't cut it.
    i posted a link any better?

  4. #4
    Registered User rstanley's Avatar
    Join Date
    Jun 2014
    Location
    New York, NY
    Posts
    1,101
    No, plus you are in the wrong forum as your code is C++, not C.

  5. #5
    Registered User awsdert's Avatar
    Join Date
    Jan 2015
    Posts
    1,733
    Quote Originally Posted by kixify View Post
    Stuck on Measuring body fat-fatcal-jpgStuck on Measuring body fat-program-png
    Im having trouble with this project for class if anyone could help me out it would be
    Women Thirty Years and Younger hips + (.80 x thigh) – (2 x calf) – wrist = % body fat
    Women over Thirty hips + thigh – (2 x calf) – wrist = % body fat
    Men Thirty Years and Younger waist + (1/2 hips) – (3 x forearm) – wrist = % body fat Men over Thirty waist + (1/2 hips) – (2.7 x forearm) – wrist = % body fat
    Men Lean Body Mass (pounds) ÷ 0.85 = correct weight to be 15% fat
    Women Lean Body Mass (pounds) ÷ 0.78 = correct weight to be 22% fat
    Those are the formulas you have to use which i did but can I go to debug and insert numbers nothing happens. Could anyone help me out?


    https://paste.mod.gg/ujesohapiq.cs
    First I don't see how that compiles because from what I see you have an unclosed if condition at the start, also that condition is hard to read as is, start by using this format on it:
    Code:
    if
    (
       cond
       && cond
       && cond
       && etc...
    )
    Finally I don't see any enclosing code block brackets
    Code:
    { and }
    encasing the code to execute, as it stands it looks like on fail it will skip only the first code statement after the if statement then continue with whatever code follows that statement, fix those 2 points 1st then I'll look again to see where else you're going wrong

  6. #6
    Registered User
    Join Date
    Feb 2021
    Posts
    3
    Quote Originally Posted by awsdert View Post
    First I don't see how that compiles because from what I see you have an unclosed if condition at the start, also that condition is hard to read as is, start by using this format on it:
    Code:
    if
    (
       cond
       && cond
       && cond
       && etc...
    )
    Finally I don't see any enclosing code block brackets
    Code:
    { and }
    encasing the code to execute, as it stands it looks like on fail it will skip only the first code statement after the if statement then continue with whatever code follows that statement, fix those 2 points 1st then I'll look again to see where else you're going wrong
    https://paste.mod.gg/posudoyipo.cs ending up making a few changes this is where i am at

  7. #7
    Registered User rstanley's Avatar
    Join Date
    Jun 2014
    Location
    New York, NY
    Posts
    1,101
    kixify:

    Please move this thread to the C++ forum, as your code IS C++ and this C forum is for the discussion of C code only.

    Thank you!

  8. #8
    Registered User awsdert's Avatar
    Join Date
    Jan 2015
    Posts
    1,733
    Quote Originally Posted by kixify View Post
    https://paste.mod.gg/posudoyipo.cs ending up making a few changes this is where i am at
    Okay 1st you didn't fix the condition brackets so you still need to fix that, also:
    Code:
    else (rdoMale.Checked == true && rdo30Over.Checked == true)
    How does that even compile? Did you mean this?
    Code:
    else if (rdoMale.Checked == true && rdo30Over.Checked == true)

  9. #9
    Registered User awsdert's Avatar
    Join Date
    Jan 2015
    Posts
    1,733
    Quote Originally Posted by rstanley View Post
    kixify:

    Please move this thread to the C++ forum, as your code IS C++ and this C forum is for the discussion of C code only.

    Thank you!
    I thought it was C# given how the file extension is *.cs, I figured that was where that abomination of "double." came from

  10. #10
    Registered User
    Join Date
    Dec 2017
    Posts
    1,626
    It's a form-based C# program. The rdo... variables refer to the state of the radio buttons. The initial 'if' statement has a semicolon at the end (and doesn't seem to do anything).
    A little inaccuracy saves tons of explanation. - H.H. Munro

  11. #11
    Registered User awsdert's Avatar
    Join Date
    Jan 2015
    Posts
    1,733
    Quote Originally Posted by john.c View Post
    The initial 'if' statement has a semicolon at the end (and doesn't seem to do anything).
    Precisely why I keep saying it needs to be fixed

  12. #12
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,656
    Moved to right forum.
    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. measuring CPU usage
    By dayalsoap in forum C Programming
    Replies: 7
    Last Post: 03-16-2017, 12:46 AM
  2. Measuring Run Time
    By BIOS in forum C Programming
    Replies: 29
    Last Post: 09-13-2011, 02:07 PM
  3. Measuring the length
    By kiros88 in forum C Programming
    Replies: 7
    Last Post: 09-11-2009, 04:32 PM
  4. measuring time in ms/us/ns
    By wanwan in forum C Programming
    Replies: 3
    Last Post: 04-29-2005, 01:42 PM
  5. Measuring time
    By BruceLeroy in forum C++ Programming
    Replies: 20
    Last Post: 10-07-2004, 02:17 PM

Tags for this Thread