本文介绍了使用C的CAPTCHA项目出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
想要在C语言上开发 CAPTCHA 项目。
但我收到错误:没有这样的文件或目录。
我正在使用GCC编译器。
错误图片: []
Want to develop a CAPTCHA project on C language.
But i am getting an error: No such file or directory.
I am using GCC compiler.
Error Image: http://postimg.org/image/5ndmy0jk5/[^]
#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\\NULL");
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;
}
}
急需帮助...
谢谢....
Need urgent help...
Thanks....
推荐答案
这篇关于使用C的CAPTCHA项目出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!