Home Forums General Discussion Problem here

Viewing 1 reply thread
  • Author
    Posts
    • #1923
      novella
      Participant

      Hey, how do u force a user to enter only letters from the keyboard in an Ansi C console Application? I’m trying to write a small program but it goes crazy when I enter any thing numeric, which I shouldn’t do.
       

    • #3165
      msaqib
      Participant

      Hello, wel if u can post the code in which u r facing difficulties.
      As far as I understand below is the solution for ur problem.

      while((key=getch())!=ESC)
      {
      switch(getch()){
      //case 1 to 10 do nothing
      //case write the characters on the screen
      }
      }

      To me this is the shortest solution to the problem above.

Viewing 1 reply thread
  • The forum ‘General Discussion’ is closed to new topics and replies.