Thread: Question for my lab about Magnitude and While Loops!

  1. #1
    Registered User
    Join Date
    Oct 2017
    Posts
    39

    Question for my lab about Magnitude and While Loops!

    My lab is asking me to create a while loop that will display the magnitude of an Esplora board.

    The magnitude is only in correspondence to the Vertical Z. (moving the board up and down in the vertical while the code runs)

    When the code is running and the Esplora board accelerates up or down rapidly, the program should print speeding up. If it slows down, it should print slowing down, else if none of the two above are true, it should print Constant Acceleration.

    I'm new to coding and haven't taken much physics, so could someone please help me with the loop?

  2. #2
    Registered User
    Join Date
    Oct 2017
    Posts
    39
    I did the wrong code, I made a loop for when the Esplora Board goes up vertically, it displays speeding up and when the vertical movement goes down, it slows down. What the lab is asking for is when it accelerates quickly, it prints speeding up and when slowly, slowing down. The constant acceleration of the board when at rest is 0.94

    Here is a pic of my code:Question for my lab about Magnitude and While Loops!-pic1-png

  3. #3
    Registered User
    Join Date
    May 2009
    Posts
    4,183
    So, fix the code; that you likely did not write!

    Note: If you use code tags instead of images; I might have decided to help; but, I hate playing twenty questions as a kid.
    I still hate playing twenty questions.

    Tim S.
    Last edited by stahta01; 10-14-2017 at 06:27 PM.
    "...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

  4. #4
    Registered User
    Join Date
    Oct 2017
    Posts
    39
    I'm new to CBoard and I'm not sure how to use code tags.. This is my code, I wrote it and just took a snip of it. I'm having trouble for my class, please help.

  5. #5
    Registered User
    Join Date
    May 2009
    Posts
    4,183
    "...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

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Determining order of magnitude of user inputed number?
    By alizzle in forum C++ Programming
    Replies: 2
    Last Post: 10-19-2010, 10:48 PM
  2. need help! Vector magnitude
    By matchkop in forum C Programming
    Replies: 4
    Last Post: 05-16-2010, 01:36 AM
  3. question on GCD and for loops
    By dals2002 in forum C Programming
    Replies: 9
    Last Post: 03-15-2008, 01:59 AM
  4. Converting Sign Magnitude Integer Binary Files
    By Arthur Dent in forum C Programming
    Replies: 7
    Last Post: 09-13-2004, 10:07 AM
  5. Replies: 5
    Last Post: 11-20-2003, 01:27 AM

Tags for this Thread