Click here to Skip to main content
15,887,853 members
Home / Discussions / C#
   

C#

 
GeneralRe: MagTek MSR , Magnetic Swipe Reader Pin
Moazza anwer29-Jun-18 0:00
Moazza anwer29-Jun-18 0:00 
Questionhow to blink a row when particular column value is todays date - VB - Access code Pin
Member 1119188529-Oct-14 22:25
Member 1119188529-Oct-14 22:25 
AnswerRe: how to blink a row when particular column value is todays date - VB - Access code Pin
Richard MacCutchan29-Oct-14 22:26
mveRichard MacCutchan29-Oct-14 22:26 
GeneralRe: how to blink a row when particular column value is todays date - VB - Access code Pin
Member 1119188529-Oct-14 22:46
Member 1119188529-Oct-14 22:46 
GeneralRe: how to blink a row when particular column value is todays date - VB - Access code Pin
OriginalGriff29-Oct-14 23:25
mveOriginalGriff29-Oct-14 23:25 
GeneralRe: how to blink a row when particular column value is todays date - VB - Access code Pin
Alaric_31-Oct-14 2:39
professionalAlaric_31-Oct-14 2:39 
AnswerRe: how to blink a row when particular column value is todays date - VB - Access code Pin
Gerry Schmitz30-Oct-14 0:05
mveGerry Schmitz30-Oct-14 0:05 
Questionhangman code in C Pin
Member 1118939529-Oct-14 10:49
Member 1118939529-Oct-14 10:49 
hello guys,
i have to write a simple project ... it is a hangman code in C#

i have this...but when I run it... i keeps printing twice some sentences... if anybody can help me... and if the user type something different from l ..when it is asked...everything goes wrong...

C#
#include <stdio.h>
#include <string.h>

/* contant declarations */
#define NUM_TRIES_ALLOWED 10

/* function prototypes */

main()
{
   /* variable declarations */
   int num_letters       = 0, /* length of word char array */
       count             = 0, /* for word char array       */
       tries             = 0, /* total tries user has used */
       num_vis_chars     = 0, /* # of visible characters   */
       correct_guesses   = 0, /* # of correct guesses      */
       correct_flag      = 0, /* was guess correct?        */
       repeat_flag       = 0, /* was guess a repeat?       */
       choice;

   char guess,guessword;

   /* array declarations */
   char word[255]              = " ";
   char incorrect_letters[255] = " ";
   /* get word */
   puts( "Enter a word for player to guess." );
   gets( word );


printf("Ready to start!\n");
   num_letters = strlen( word );
   char visible_word[num_letters]; /* displays correct guesses */

   /* initialize visble_word */
   for( count = 0; count < num_letters; count++ )
      visible_word[count] = '*';

   visible_word[num_letters] = '\0';



if (guess == visible_word[count]){

   while( tries < NUM_TRIES_ALLOWED )
   {

      printf( "The word is: %s\n\n", visible_word );
      printf("Number of turns remaining: %d", NUM_TRIES_ALLOWED-tries);
      printf("\nWould you like to guess the word [w] or guess a letter [l]:");
        choice = getchar();

            if (choice=='l'){

      printf( "\nWhat letter have you chosen?:\t " );
      scanf( " %c", &guess );}

            /* match guess against previous guesses */
      for( count = 0; count < num_letters; count++ )
         if( guess == visible_word[count] || guess == incorrect_letters[count] )
         {
            repeat_flag  = 1;
            correct_flag = 1;
            break;
         }

      if( repeat_flag == 0 )
         /* check for matches in string */
         for( count = 0; count < num_letters; count++ )
         {
            if( guess == word[count] )
            {
            visible_word[count] = guess;
            correct_guesses++;
            printf("\n**************************************************************\n\n");
            printf("Good choice!\n\n");

               if( correct_guesses == num_letters )
               {
                  puts( "\n\nCONGRATULATIONS! You guessed the word!" );
                  printf( "WORD: %s\n\n", visible_word );
                  exit( 0 );
               }

               correct_flag = 1;
            }

         }

      if( correct_flag == 0 )
      {
         incorrect_letters[tries] = guess;
         tries++;
         printf("\n**************************************************************\n\n");
         printf("Bad choice!\n\n");

      }

      /* reset flags */
      repeat_flag  = 0;
      correct_flag = 0;


   }

   puts( "You did not guess the word." );
   printf( "WORD: %s\n\n", visible_word );


}
if (choice='w'){

      printf( "\nWhat word have you chosen?:\t " );

      scanf( "%s", &guessword );

      if(guessword==word){
      printf("CONGRATULATIONS! You guessed the word!");}
      else{ printf("nops");
      }
      }

return 0;
}

AnswerRe: hangman code in C Pin
Eddy Vluggen29-Oct-14 10:53
professionalEddy Vluggen29-Oct-14 10:53 
Questionc#.net desktop application Deployment issue Pin
aarav1234529-Oct-14 7:55
aarav1234529-Oct-14 7:55 
AnswerRe: c#.net desktop application Deployment issue Pin
Pete O'Hanlon29-Oct-14 8:25
mvePete O'Hanlon29-Oct-14 8:25 
GeneralRe: c#.net desktop application Deployment issue Pin
aarav1234529-Oct-14 8:29
aarav1234529-Oct-14 8:29 
GeneralRe: c#.net desktop application Deployment issue Pin
OriginalGriff29-Oct-14 9:13
mveOriginalGriff29-Oct-14 9:13 
QuestionOld famous problem. Access to Form1 from other namespace Pin
Member 1115157129-Oct-14 5:37
Member 1115157129-Oct-14 5:37 
QuestionRe: Old famous problem. Access to Form1 from other namespace Pin
Richard MacCutchan29-Oct-14 5:53
mveRichard MacCutchan29-Oct-14 5:53 
AnswerRe: Old famous problem. Access to Form1 from other namespace Pin
Dave Kreskowiak29-Oct-14 5:53
mveDave Kreskowiak29-Oct-14 5:53 
GeneralRe: Old famous problem. Access to Form1 from other namespace Pin
Member 1115157130-Oct-14 22:06
Member 1115157130-Oct-14 22:06 
GeneralRe: Old famous problem. Access to Form1 from other namespace Pin
Dave Kreskowiak31-Oct-14 7:44
mveDave Kreskowiak31-Oct-14 7:44 
AnswerRe: Old famous problem. Access to Form1 from other namespace Pin
Pete O'Hanlon29-Oct-14 5:54
mvePete O'Hanlon29-Oct-14 5:54 
SuggestionRe: Old famous problem. Access to Form1 from other namespace Pin
Richard Deeming29-Oct-14 6:46
mveRichard Deeming29-Oct-14 6:46 
GeneralRe: Old famous problem. Access to Form1 from other namespace Pin
Member 1115157130-Oct-14 22:08
Member 1115157130-Oct-14 22:08 
GeneralRe: Old famous problem. Access to Form1 from other namespace Pin
Member 1115157130-Oct-14 4:19
Member 1115157130-Oct-14 4:19 
GeneralRe: Old famous problem. Access to Form1 from other namespace Pin
Pete O'Hanlon30-Oct-14 4:29
mvePete O'Hanlon30-Oct-14 4:29 
GeneralRe: Old famous problem. Access to Form1 from other namespace Pin
Member 1115157130-Oct-14 5:42
Member 1115157130-Oct-14 5:42 
GeneralRe: Old famous problem. Access to Form1 from other namespace Pin
Pete O'Hanlon30-Oct-14 5:44
mvePete O'Hanlon30-Oct-14 5:44 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.