Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
U

User 11155132

@User 11155132
About
Posts
3
Topics
2
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • hangman code in C
    U User 11155132

    my debugger screen is grey, I tried to do this....but I couldnt

    C / C++ / MFC csharp data-structures regex help question

  • hangman code in C
    U User 11155132

    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...

    #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\_wo
    
    C / C++ / MFC csharp data-structures regex help question

  • hangman code in C
    U User 11155132

    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...

    #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\[
    
    C# csharp data-structures regex help question
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups