一个密码输入小程序!有趣!进来看看!
<P>#include "process.h"#include "stdio.h"
int main(void)
{
int i=0,count=0;
char c,aa,bb="abc";
clrscr();
textbackground(1);
textcolor(4);
Loop:
gotoxy(25,12);
cprintf("Input your password:"); /*当然在这里输入要输入与bb同样的值 */
while((c=getch())!=13)
{
aa=c;
gotoxy(45+i,12);
cprintf("*");
if(i>20)
break;
}
aa=0;
if(strcmp(aa,bb)==0)
{
gotoxy(25,13);
cprintf("Your password input right!!!");
gotoxy(25,14);
printf("the window will close,thank you");
delay(10000000);
getch(); /*正确输入后,将退出其不意*/
exit(0);
close();
}
else
{ i=0;
count++;
gotoxy(25,13);
cprintf("Your password input error!!!");
getch();
{
gotoxy(25,14);
if(count>3)
{
cprintf("You put the wrong number too many times");</P>
<P>gotoxy(25,15);
cprintf("so the computer must SHOUT DOWN!");
getch();
exit(0);
close();
}
delay(10000000000);
clrscr();
goto Loop;
}
}
getch() ;
}</P>
<P> </P>
<P> 来源---网上</P>
<P> </P>
呵呵
小生尝试了一下,果然不错,顶! <P>不错不错,只是密码输入后,不能用“Backspace”修改。。</P><P>我在里面填了几句,实现修改的功能。</P><P> while((c=getch())!=13){
if(c==8){i--;gotoxy(46+i,12);cprintf(" ");gotoxy(46+i,12);}
else{
aa=c;
gotoxy(45+i,12);
cprintf("*");
if(i>20) break;}
}</P> <P>哈哈!</P><P>没想到!</P><P>谢谢!</P><P>再补充</P> <P>我试过怎么不行???/.cpp
C:\Documents and Settings\Administrator\1.cpp(7) : error C2065: 'clrscr' : undeclared identifier
C:\Documents and Settings\Administrator\1.cpp(8) : error C2065: 'textbackground' : undeclared identifier
C:\Documents and Settings\Administrator\1.cpp(9) : error C2065: 'textcolor' : undeclared identifier
C:\Documents and Settings\Administrator\1.cpp(11) : error C2065: 'gotoxy' : undeclared identifier
C:\Documents and Settings\Administrator\1.cpp(12) : error C2065: 'cprintf' : undeclared identifier
C:\Documents and Settings\Administrator\1.cpp(13) : error C2065: 'getch' : undeclared identifier
C:\Documents and Settings\Administrator\1.cpp(18) : error C2065: 'gt' : undeclared identifier
C:\Documents and Settings\Administrator\1.cpp(18) : error C2143: syntax error : missing ')' before ';'
C:\Documents and Settings\Administrator\1.cpp(18) : warning C4390: ';' : empty controlled statement found; is this the intent?
C:\Documents and Settings\Administrator\1.cpp(18) : error C2059: syntax error : ')'
C:\Documents and Settings\Administrator\1.cpp(19) : error C2143: syntax error : missing ';' before 'break'
C:\Documents and Settings\Administrator\1.cpp(22) : error C2065: 'strcmp' : undeclared identifier
C:\Documents and Settings\Administrator\1.cpp(28) : error C2065: 'delay' : undeclared identifier
C:\Documents and Settings\Administrator\1.cpp(31) : error C2065: 'close' : undeclared identifier
C:\Documents and Settings\Administrator\1.cpp(41) : error C2143: syntax error : missing ')' before ';'
C:\Documents and Settings\Administrator\1.cpp(41) : warning C4390: ';' : empty controlled statement found; is this the intent?
C:\Documents and Settings\Administrator\1.cpp(41) : error C2059: syntax error : ')'
C:\Documents and Settings\Administrator\1.cpp(42) : error C2143: syntax error : missing ';' before '{'
C:\Documents and Settings\Administrator\1.cpp(43) : error C2143: syntax error : missing ';' before '<'
C:\Documents and Settings\Administrator\1.cpp(56) : warning C4508: 'main' : function should return a value; 'void' return type assumed
C:\Documents and Settings\Administrator\1.cpp(56) : error C2143: syntax error : missing ';' before '<'
C:\Documents and Settings\Administrator\1.cpp(58) : error C2018: unknown character '0xc0'
C:\Documents and Settings\Administrator\1.cpp(58) : error C2018: unknown character '0xb4'
C:\Documents and Settings\Administrator\1.cpp(58) : error C2018: unknown character '0xd4'
C:\Documents and Settings\Administrator\1.cpp(58) : error C2018: unknown character '0xb4'
C:\Documents and Settings\Administrator\1.cpp(58) : error C2018: unknown character '0xcd'
C:\Documents and Settings\Administrator\1.cpp(58) : error C2018: unknown character '0xf8'
C:\Documents and Settings\Administrator\1.cpp(58) : error C2018: unknown character '0xc9'
C:\Documents and Settings\Administrator\1.cpp(58) : error C2018: unknown character '0xcf'
Error executing cl.exe.</P><P>1.exe - 26 error(s), 3 warning(s)
</P> <P>因为你是直接拷贝放在编译器里面执行的!这里网页上有一些不可见的控制符号!所以提示有非法字符!注意将一些空格重新输入一下就行了!</P>
页:
[1]