用C语言随机数来制作验证码程序,可以将这段代码假如各位童鞋的程序哦{:soso__14193165834053582185_1:}- #include <stdio.h>
- #include <windows.h>
- #include<time.h>
- #include <stdlib.h>
- int main()
- {
- int a,b,c;
-
- printf("为了确认您不是机器人,请如实回答以下问题:\n");
- f:;
- srand((int)time(0));
- a=rand()%50+1;
- b=rand()%50+1;
- c=a+b;
- printf("%d+%d等于几?\n",a,b);
- scanf("%d",&a);
- if(a!=c)
- {
- printf("答案错误!请重新计算\n");
- MessageBeep(MB_ICONSTOP);
- goto f;
- }
- MessageBeep(48);
- printf("欢迎你人类\n");
- system("pause");
- system("cls");
- Sleep(5000);
- return 0;
- }
复制代码 |