looping problem

This is a discussion on looping problem within the C Programming forums, part of the General Programming Boards category; Code: while((quit=getc(stdin))!='q'); print crap p ++; i'm trying to make a loop that keeps going if the user pushes 'enter' ...

  1. #1
    Registered User
    Join Date
    Sep 2003
    Posts
    13

    looping problem

    Code:
      while((quit=getc(stdin))!='q');
    print crap
    p ++;

    i'm trying to make a loop that keeps going if the user pushes 'enter' and will quit when they hit 'q' ..

    so far this just prints one line.. and if you hit enter it just keeps on pumping out blank lines...

    can someone help me... i'm just switching to C from C++ and i'm not used to the input functions yet.

    thanks,
    John

  2. #2
    Pursuing knowledge confuted's Avatar
    Join Date
    Jun 2002
    Posts
    1,916
    http://www.stud.ntnu.no/~shane/stasj...ilder/192.html

    And then get rid of the ; at the end of your while loop.
    Away.

  3. #3
    Registered User
    Join Date
    Sep 2003
    Posts
    13
    hahahaahhaah

    nice -- i deserved that...


    thanks man
    john

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Words and lines count problem
    By emo in forum C Programming
    Replies: 1
    Last Post: 07-12-2005, 03:36 PM
  2. looping problem
    By chris285 in forum C++ Programming
    Replies: 4
    Last Post: 04-22-2005, 11:03 AM
  3. half ADT (nested struct) problem...
    By CyC|OpS in forum C Programming
    Replies: 1
    Last Post: 10-26-2002, 08:37 AM
  4. binary tree problem - help needed
    By sanju in forum C Programming
    Replies: 4
    Last Post: 10-16-2002, 05:18 AM
  5. Looping problem
    By sketchit in forum C Programming
    Replies: 2
    Last Post: 10-01-2001, 02:19 PM

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