Thread: Code Question

  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

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, 11:22 AM
  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, 11:05 AM
  5. Code Question
    By Drew in forum C++ Programming
    Replies: 4
    Last Post: 08-30-2003, 11:59 AM