Thread: beep when even?

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #5
    Hardware Engineer
    Join Date
    Sep 2001
    Posts
    1,398
    You severely need to learn indentation:
    Ahmed,

    But, it's not the indentation that's causing your bug. It's the placement of the curly braces.

    You have a pair of braces following your if-statement. Everything inside the braces depends on the if-condition. The "beep" code is not inside the braces, so it gets executed every time through the loop, regardless of the if-condition.
    Last edited by DougDbug; 11-06-2008 at 06:52 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. linux beep function
    By Calef13 in forum C++ Programming
    Replies: 7
    Last Post: 07-14-2007, 01:39 AM
  2. I need to play a pre recorded vox file using C
    By m.sudhakar in forum C Programming
    Replies: 4
    Last Post: 11-17-2006, 06:59 PM
  3. alert beep sound
    By bazzano in forum C Programming
    Replies: 3
    Last Post: 02-14-2006, 02:24 PM
  4. Beep();
    By SirCrono6 in forum C++ Programming
    Replies: 7
    Last Post: 02-22-2004, 04:47 PM
  5. Something Like beep()
    By Trauts in forum C++ Programming
    Replies: 3
    Last Post: 02-02-2003, 02:51 PM