Thursday, September 27, 2012

Captcha program in C with Source code

This program generates captcha, a captcha is a random code generated using some algorithm. We will use random function in our code. These are used in typing tutors and in website to check whether a human is operating on a website.


C programming code

#include<stdlib.h>
#include<dos.h>
#include<graphics.h>
 
main()
{
   int i = 0, key, num, midx, gd = DETECT, gm;
   char a[10];
 
   initgraph(&gd,&gm,"C:\\TC\\BGI");
 
   midx = getmaxx()/2;
 
   settextstyle(SCRIPT_FONT,HORIZ_DIR,5);
   settextjustify(CENTER_TEXT,CENTER_TEXT);
   setcolor(GREEN);
   outtextxy(midx,20,"CAPTCHA");
   settextstyle(SCRIPT_FONT,HORIZ_DIR,2);
   outtextxy(midx,125,"Press any key to change the generated random code \"captcha\"");
   outtextxy(midx,150,"Press escape key to exit...");
 
   setcolor(WHITE);
   setviewport(100,200,600,400,1);
   setcolor(RED);
   randomize();
 
   while(1)
   {
      while(i<6)
      {
         num = random(3);
 
         if ( num == 0 )
            a[i] = 65 + random(26);     /* 65 is the ASCII value of A */
         else if ( num == 1)
            a[i] = 97 + random(26);     /* 97 is the ASCII value of a */
         else
            a[i] = 48 + random(10);     /* 48 is the ASCII value of 0 */
         i++;
      }
      a[i] = '\0';
      outtextxy(210,100,a);
      key = getch();
 
      if( key == 27 )                     /* escape key*/
         exit(0);
      clearviewport();
      i = 0;
   }
}
Output of program:

Cool Hack,To print Series of numbers without LOOP

Hello friends today i am posting this new code which is very interesting .C program to print first n natural numbers without using any loop(do while, for or while). In the first program we will use recursion to achieve the desired output and in the second we use goto statement i.e. without creating any function other than main


C programming code using recursion


#include <stdio.h>
 
void print(int);
 
int main()
{
  int n;
 
  scanf("%d", &n);
 
  print(n);
 
  return 0;
}
 
void print(int n)
{
  static int c = 1;
 
  if (c == n+1)
    return;
 
  printf("%d\n", c);
  c++;
  print(n);
}

OUTPUT OF ABOVE CODE:

Sunday, December 19, 2010

Sorry Friends!!!!!!!!

Sorry friends for not posting new Topics Actually I am Busy In My Exams So I will be available After 9 Jan Till Then Have Faith In Me And Keep on Earning Money I will Be Back With New Year Bash For All Of you...........Wish me Luck Guys

Friday, December 3, 2010

MAKE UNLIMTED FREE CALLS ON ANY NETWORK

Enjoy
Now Here Is An Exciting Offer From PennyTel here if you will register now You will Recieve 10 Million Minutes For Free Calling On Any Network In India Or Abroad......

You Will Require A Gprs Enabled Handset Or You Can Use it Via Computer...After Registering You Will Have to Click On the Banner As Shown Above...Now You Are ready To Call Your Loved Ones For Free....

Saturday, November 27, 2010

Paint In C

Here is my Latest Project Which i have Designed Using the C-Language Using This You Can Draw Any Small Design On the Computer With the Help Of Mouse On The Editor Designed on C-Language

Click To Download

PAC-MAN Game In C

This is the modified version of the famous game 'PAC-MAN' it is very similar to it,but it is designed on  C-language,a very nice combination of some Math functions ...

CLICK HERE TO DOWNLOAD

Bricks game in C

Here I am Posting A old game which all of you must have played in your child hood but have you ever think that you can easily design the "BRICK GAME" in 'C' here i am posting the source code of the game tested by me.....

here is the screen shot

CLICK HERE TO DOWNLOAD