terminating input by ctrl+z

This is a discussion on terminating input by ctrl+z within the C++ Programming forums, part of the General Programming Boards category; How to terminate the input by entering ctrl+z. I have a sentinel controlled loop that should break when ctrl+z is ...

  1. #1
    Just a Member ammar's Avatar
    Join Date
    Jun 2002
    Posts
    953

    terminating input by ctrl+z

    How to terminate the input by entering ctrl+z.
    I have a sentinel controlled loop that should break when ctrl+z is entered.

    Code:
    int x=0;
    
    while( condition )
    {
         cin >> x;
         do something
    }
    what's the condition

  2. #2
    S Sang-drax's Avatar
    Join Date
    May 2002
    Location
    Göteborg, Sweden
    Posts
    2,072
    while(cin)
    Last edited by Sang-drax : Tomorrow at 02:21 AM. Reason: Time travelling

  3. #3
    Just a Member ammar's Avatar
    Join Date
    Jun 2002
    Posts
    953
    Ok if I have a situation like this.

    Code:
    for ( ;; )
    {
         cin >> x;
         if ( condition )
              break;
         cin >> y;
         ........
    }
    what could that condition be: if ( cin )?
    Thanks for help.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. I would love some input on my BST tree.
    By StevenGarcia in forum C++ Programming
    Replies: 4
    Last Post: 01-15-2007, 12:22 AM
  2. About aes
    By gumit in forum C Programming
    Replies: 13
    Last Post: 10-24-2006, 03:42 PM
  3. Structure and Linked List User Input Question
    By kevndale79 in forum C Programming
    Replies: 16
    Last Post: 10-05-2006, 11:09 AM
  4. need help with some input
    By blindleaf in forum C Programming
    Replies: 2
    Last Post: 03-16-2003, 12:50 PM
  5. Writing past ...
    By Ana Val sazi in forum C++ Programming
    Replies: 8
    Last Post: 06-29-2002, 08:43 AM

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