Code Question

This is a discussion on Code Question within the C Programming forums, part of the General Programming Boards category; hello there, i see this code in the net where i can input a word and make it hidden, but ...

  1. #1
    Registered User
    Join Date
    Sep 2012
    Posts
    29

    Code Question

    hello there, i see this code in the net where i can input a word and make it hidden, but i didnt know how did they make that code...can anyone explain this to me...thanks in advance...

    Code:
     
    
    char word[100];
    char c;
    int x=0;
    
    printf("enter a word to guess: \n");
         do{
               c=getch();
               switch(c)
               {
                   case '\r':
                        break;
                   case '\b':
                        printf("\b \b");
                        if(x>0) --x;
                        break;
                   default:
                           printf("%c", '*');
                           word[x++]=c;
                           break;
               }
            }while(c != '\r');
            word[x]='\0';

  2. #2
    SAMARAS std10093's Avatar
    Join Date
    Jan 2011
    Location
    Nice, France
    Posts
    2,694

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Question about code
    By Aeria Gloris in forum C Programming
    Replies: 1
    Last Post: 02-28-2011, 11:52 PM
  2. C code and R question
    By chnebu in forum C Programming
    Replies: 3
    Last Post: 05-13-2010, 12:22 PM
  3. A question about c++ code and what to use
    By hunterx1x in forum C++ Programming
    Replies: 10
    Last Post: 02-19-2010, 03:04 PM
  4. Hi all i have a question about a code
    By iweapons in forum C++ Programming
    Replies: 5
    Last Post: 05-23-2007, 12:05 PM
  5. Code Question
    By Drew in forum C++ Programming
    Replies: 4
    Last Post: 08-30-2003, 12:59 PM

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