Checking input

This is a discussion on Checking input within the C Programming forums, part of the General Programming Boards category; I am new with C i have some problem how can i check a string input by the user is ...

  1. #1
    Unregistered
    Guest

    Checking input

    I am new with C
    i have some problem
    how can i check a string input by the user is all letters ( A to Z)
    i know just using switch case which i have to declare each single of them a.b.c...z i think
    any advice?
    Thanks

  2. #2
    ....
    Join Date
    Aug 2001
    Location
    Groningen (NL)
    Posts
    2,386
    If S is a string and s0 is the first character and sn the last character, then create a loop whose counter i runs from 0 to n. For each si check if it is a character of the alphabet. Checking if a character is an character of the alphabet can be done by checking if the character is in the range 'A'..'Z' or with the function isalpha(). But the function isalpha() also checks if the character is in the range 'a'..'z'.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. About aes
    By gumit in forum C Programming
    Replies: 13
    Last Post: 10-24-2006, 03:42 PM
  2. Checking for flag input through argv
    By cisokay in forum C Programming
    Replies: 6
    Last Post: 05-11-2005, 10:51 AM
  3. Checking input
    By Unregistered in forum C Programming
    Replies: 3
    Last Post: 05-10-2002, 09:00 AM
  4. checking if input is a number ?
    By Unregistered in forum C++ Programming
    Replies: 2
    Last Post: 12-06-2001, 08:07 PM

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