Thread: isspace()

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    Dec 2007
    Posts
    932

    isspace()

    What is wrong with that code?
    It executes else() but wont execute if(). It just hangs.

    Code:
    #include <iostream>
    #include <cctype>
    
    using namespace std;
    
    int main()
    { 
       char x;
       for (;;)
       {
            cout << "Type a character: " << endl; 
            cin >> x;
            if( isspace(x) )
            {
                cout << "It's a space." << endl;
            }
            else
            {
                cout << "It's not a space." << endl;  
            }
        }
    }
    Last edited by Ducky; 03-10-2008 at 01:49 PM.
    Using Windows 10 with Code Blocks and MingW.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. for and isspace
    By izzy in forum C Programming
    Replies: 2
    Last Post: 03-15-2009, 06:18 PM
  2. pointer with isspace()
    By aze in forum C Programming
    Replies: 6
    Last Post: 04-17-2004, 09:43 PM
  3. isspace() is the way!
    By Luigi in forum C++ Programming
    Replies: 3
    Last Post: 02-02-2003, 10:23 AM
  4. Isspace ??? Anyone Know?
    By justin69enoch in forum C Programming
    Replies: 12
    Last Post: 01-23-2003, 05:02 PM