Crossword Game in C


My first project of academics. Learning and making use of C language is compulsory for a beginner programmer. Crossword game developed in C , was a challenge for someone like me, who has just started playing with loops and arrays, but ended with an extensive use of some cool features, which I never thought of.

Things I learnt :

1. Using Graphics is C with a little animation ( animation by use of delay and changing position).

2. Using bitmaps in C ( There is a external header file naming bitmap.h by which you can add a picture n C)

3. The use of TIMER (a clock that doesn’t stop even if interrupted by keyboard or mouse) by a keyword called bioskey

4. Use of mouse in C

5. Filing in C

Report (The entire project report in PDF)

Enhanced by Zemanta
Advertisements

About Tariq Mehmood Khatri

This is Tariq Mehmood Khatri, currently doing Bachelors in Computer & Information Systems Engineering. I think, everything in this world is logical, so my life circle revolves in finding logic behind everything.
This entry was posted in My projects, Web and tagged , , , , , , , , , , , , , , , . Bookmark the permalink.

3 Responses to Crossword Game in C

  1. kirlia says:

    please post the codes for your timer. i badly need it. please

    • float check_time_limit(clock_t start)
      {

      int x,var=0;
      char *temp;
      char * temp1;
      clock_t end;
      end = clock();
      x=(end – start)/CLK_TCK;
      settextstyle(3,0,2);

      if(x>59 && x119 && x179 && x239 && x299 && x359 && x419 && x<480)
      { var=7;
      x-=420;
      }

      else if(x==480)
      { var=8;
      x-=480;
      }
      itoa(x,temp,10);
      itoa(var,temp1,10);
      setcolor(LIGHTGRAY);
      outtextxy(500,380,temp1);
      outtextxy(518,380,":");
      setcolor(LIGHTGRAY);
      outtextxy(528,380,temp);
      delay(100);
      setfillstyle(SOLID_FILL,BLACK);
      bar(475,375,650,415);

      if((var==5 && l1==1 && l2==0) || (var==8 && l1==0 && l2==1))
      {
      setcolor(LIGHTGRAY);
      outtextxy(500,380,temp1);
      outtextxy(518,380,":");
      setcolor(LIGHTGRAY);
      outtextxy(528,380,temp);

      outtextxy(20,20,"time's up");
      getch();
      exit(0);
      }

      return x;
      }

      The above function displays the time, and is called before you want to take any i/p from user, and immediately the user presses any key, this function is again called.
      Make sure, the above code will be displayed in graphics mode.
      You have to include file as well

      clock_t start;
      start = clock();

      The above two lines initiate time and current time gets saved in start variable,

      while((ch=bioskey(1))==0)
      check_time_limit(start);

      The above two lines are executed until user hits any key. I/p is taken by the function bioskey(),if it returns 0, nothing is pressed, so is the above logic, if nothing is pressed, show the time, and the function check_time_limit() gets the current time, does some processing, and starts a timer, for some time.

      ch=bioskey(0);
      check_time_limit(start);
      When user hits any key, ‘ch’ holds the value, and as I said above, we have to again display the time, so the function is called again on the next line.

      Hope you understood.

  2. kirlia says:

    the time doesn’t move whenever i don’t input a word.

    #include
    #include
    #include
    time_t t1,t2;
    main(void)
    {
    int ch;
    char x;
    clrscr();
    (void) time(&t1);
    while((ch=bioskey(1))==0)
    {
    ch=bioskey(0);
    (void) time(&t2);
    gotoxy(10,10);printf(” %d seconds remaining”, (15-(t2-t1)));
    gotoxy(11,11);x=getche();
    gotoxy(12,12);printf(“%c”,x);

    }
    getch();
    return 0;
    }

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s