QQ登录

只需要一步,快速开始

 注册地址  找回密码
查看: 3469|回复: 5
打印 上一主题 下一主题

一个密码输入小程序!有趣!进来看看!

[复制链接]
字体大小: 正常 放大
solucky        

17

主题

1

听众

109

积分

升级  4.5%

该用户从未签到

跳转到指定楼层
1#
发表于 2004-6-4 11:33 |只看该作者 |倒序浏览
|招呼Ta 关注Ta
<>#include "process.h" / o5 s4 U1 J" W& e2 t/ z1 P8 \
#include "stdio.h" . A: i' U" e" J
int main(void)
# {  W. D9 D& v! a3 P8 }0 v# F{
% k3 }6 p- Q- \+ Tint i=0,count=0;
2 ~/ Q, U+ P" v4 c1 H' wchar c,aa[20],bb[10]="abc"; 7 a- J4 p8 i# ]$ v0 E" o
clrscr(); - }' Z- N! E8 \( U! U, j0 k1 i  X
textbackground(1); " I: X3 M; F7 s8 D. C; d/ q7 L* U
textcolor(4); / @3 r2 X, `  ]* j, I1 \
Loop: + s7 w9 ?2 B1 w1 y
gotoxy(25,12);
3 y) H+ R/ q9 y* Tcprintf("Input your password:"); /*当然在这里输入要输入与bb[10]同样的值  */
0 A, ?3 q  L% c- Y) {. o! Zwhile((c=getch())!=13)
: W6 _: `) D8 d6 g  H{
4 m4 a( G4 {1 q& B: ~aa[i++]=c; 1 A3 t* V* ]/ t0 {0 h/ O
gotoxy(45+i,12); ' X9 ?" d  P7 ^
cprintf("*");
' [: N- U7 N+ zif(i&gt;20) 9 U2 T8 E) O( U
break; 0 Y& h. l- J# E; o' B" ?& ?
}
) M& l+ }( ^; S+ kaa=0; & ^& q  }9 x9 I) g' I
if(strcmp(aa,bb)==0) # Z$ I$ }$ s" Z1 k; l0 ?3 L
{ ' [* X1 `7 R3 v+ ?0 |
gotoxy(25,13);
9 J* s+ k+ ]. n2 y4 t% F; }cprintf("Your password input right!!!");3 i! d7 ]$ L6 t+ X7 U' ?
gotoxy(25,14);9 M. j6 B" _  `  `$ P
printf("the window will close,thank you");
! O+ a: y: T/ k* c$ Idelay(10000000); 5 c! H7 h1 _8 ^4 x/ C1 ~
getch(); /*正确输入后,将退出其不意*/
' g0 s, e0 y( z+ ~, `, y) Lexit(0);
! c1 z( }0 b7 I5 O' [% S! U$ i  \close(); " h4 N5 j# `' I
}
$ O% ~6 z2 _( N, H( Pelse
  H( I5 g0 Q* a' D6 D: v7 f{ i=0;
9 ?  k1 e5 Q) @3 H' pcount++; % r! m8 b- ^5 }* \3 l, N
gotoxy(25,13); ' b( R3 @5 @, a1 ~$ i' l
cprintf("Your password input error!!!");
1 c- n' u6 Q+ {/ Fgetch();$ [' W! a& J% v' O1 v6 t. l
{ # E) `- h# W" P/ N* {! }
gotoxy(25,14); : a5 ^2 _; O7 d* w
if(count&gt;3) 5 K7 y  p6 B0 u& k# M5 ?0 u$ s+ D1 g
{ ( y# M; s+ p" }/ B" n7 f5 v( d
cprintf("You put the wrong number too many times");</P>
3 z+ R! i9 T  r& J' ^8 Z+ a<>gotoxy(25,15);
/ x3 K2 Y. \" b: i! ~- rcprintf("so the computer must SHOUT DOWN!"); + h- g8 u$ N7 b% C0 T
getch();
  F# l  S# l" Z% N) u0 N% e) bexit(0);
1 G3 |" R6 V, f2 t! |% b+ ^close();4 I5 [  o5 u9 o! c1 Z- {
} " @* @; K' R/ w& j* V  f, \
delay(10000000000); ; u4 a5 d) m2 s7 b) E' y
clrscr();$ g) }* |8 z/ P9 H* r2 p7 R0 {) N
goto Loop; 9 e' h( y; }  i1 t3 ?
} 8 g# P0 B/ F& n  Z( x
}
$ m( U4 \( V8 z' S) R+ u- ?, Rgetch() ;
" ~7 Y! w9 e/ I) C}</P>
1 o, z* }6 v. [4 @2 U1 C% G<>              </P>/ x) ~- @8 U# ?6 J* C
<>        来源---网上</P>
( C0 B: t- R7 `<>                                          </P>
zan
转播转播0 分享淘帖0 分享分享0 收藏收藏0 支持支持0 反对反对0 微信微信
笑一笑 只牵动苦涩的嘴角 我的寂寞谁知道 我害怕 用真心面对这世界 只好越来越沉默

1

主题

0

听众

25

积分

升级  21.05%

该用户从未签到

新人进步奖

回复

使用道具 举报

pride        

0

主题

1

听众

22

积分

升级  17.89%

该用户从未签到

新人进步奖

<>不错不错,只是密码输入后,不能用“Backspace”修改。。</P><>我在里面填了几句,实现修改的功能。</P><> while((c=getch())!=13)
" u. Y4 ^! w3 |7 D$ v' k* C3 G  {, G& ?+ L+ r1 F; H4 I7 J1 Q
   if(c==8){i--;gotoxy(46+i,12);cprintf(" ");gotoxy(46+i,12);}
5 ?3 L# e+ \; s6 J9 H) k   else{) B; E9 d6 i, J# |
   aa[i++]=c;
$ s' w0 [! ^; `1 y0 z+ s   gotoxy(45+i,12);! @* w6 i, b. |0 S; [( w
   cprintf("*");
4 E! _! K" L' D% \% A/ h   if(i&gt;20) break;}
$ A) e$ T3 t; r$ A& ]8 a& t  }</P>
回复

使用道具 举报

solucky        

17

主题

1

听众

109

积分

升级  4.5%

该用户从未签到

回复

使用道具 举报

0

主题

0

听众

19

积分

升级  14.74%

该用户从未签到

新人进步奖

<>我试过怎么不行???/.cpp
( f, f6 D) u, k: O! l+ KC:\Documents and Settings\Administrator\1.cpp(7) : error C2065: 'clrscr' : undeclared identifier
4 n' r* R0 g8 ]9 o  S/ n7 {C:\Documents and Settings\Administrator\1.cpp(8) : error C2065: 'textbackground' : undeclared identifier
4 ~2 F' F+ H# T, f  t7 Y8 [/ q; vC:\Documents and Settings\Administrator\1.cpp(9) : error C2065: 'textcolor' : undeclared identifier
1 C" f. l6 G8 ^; L5 Y- yC:\Documents and Settings\Administrator\1.cpp(11) : error C2065: 'gotoxy' : undeclared identifier
# H: {. w% w( t- s% Q; \+ M6 pC:\Documents and Settings\Administrator\1.cpp(12) : error C2065: 'cprintf' : undeclared identifier
* F( z. v3 d5 K: lC:\Documents and Settings\Administrator\1.cpp(13) : error C2065: 'getch' : undeclared identifier
  L- h4 J7 p& _' t& e; u( d4 n; LC:\Documents and Settings\Administrator\1.cpp(18) : error C2065: 'gt' : undeclared identifier1 P. I) E; r6 L% x
C:\Documents and Settings\Administrator\1.cpp(18) : error C2143: syntax error : missing ')' before ';'
2 x* f6 o$ L- n$ P# l$ J8 M" SC:\Documents and Settings\Administrator\1.cpp(18) : warning C4390: ';' : empty controlled statement found; is this the intent?% m: G. B0 o: c9 \; I8 z
C:\Documents and Settings\Administrator\1.cpp(18) : error C2059: syntax error : ')': I4 W6 I# b" z8 O! Y. l
C:\Documents and Settings\Administrator\1.cpp(19) : error C2143: syntax error : missing ';' before 'break'. X2 y. \. e( W
C:\Documents and Settings\Administrator\1.cpp(22) : error C2065: 'strcmp' : undeclared identifier- y$ c+ b; w+ R- y6 V
C:\Documents and Settings\Administrator\1.cpp(28) : error C2065: 'delay' : undeclared identifier0 R  s9 T8 y- D+ s$ X& k( ?. q
C:\Documents and Settings\Administrator\1.cpp(31) : error C2065: 'close' : undeclared identifier$ p0 V9 r" j) q$ P0 ?' @
C:\Documents and Settings\Administrator\1.cpp(41) : error C2143: syntax error : missing ')' before ';': H! y# M+ h' D/ \0 q& h! m
C:\Documents and Settings\Administrator\1.cpp(41) : warning C4390: ';' : empty controlled statement found; is this the intent?
0 b- L/ R+ a* i- A5 P" T6 u) \C:\Documents and Settings\Administrator\1.cpp(41) : error C2059: syntax error : ')'
3 i8 i! R$ a; L" a3 mC:\Documents and Settings\Administrator\1.cpp(42) : error C2143: syntax error : missing ';' before '{'' N) J# w5 x7 ?% L4 x
C:\Documents and Settings\Administrator\1.cpp(43) : error C2143: syntax error : missing ';' before '&lt;'
& A+ E. c/ s! w. Z* ?0 S3 ?C:\Documents and Settings\Administrator\1.cpp(56) : warning C4508: 'main' : function should return a value; 'void' return type assumed
5 X9 P# @  B( m1 CC:\Documents and Settings\Administrator\1.cpp(56) : error C2143: syntax error : missing ';' before '&lt;'& f! C, f% i, B* F8 ^+ r9 E
C:\Documents and Settings\Administrator\1.cpp(58) : error C2018: unknown character '0xc0'
. ?0 O/ |- p9 c2 E  lC:\Documents and Settings\Administrator\1.cpp(58) : error C2018: unknown character '0xb4', f% F0 X; @  j3 G8 l3 P
C:\Documents and Settings\Administrator\1.cpp(58) : error C2018: unknown character '0xd4'
& U! u- p% h. [4 e5 sC:\Documents and Settings\Administrator\1.cpp(58) : error C2018: unknown character '0xb4'
( F2 J, ^$ o9 L/ J3 @C:\Documents and Settings\Administrator\1.cpp(58) : error C2018: unknown character '0xcd'/ X/ ]/ h' A4 g4 c9 @' X  @# ^) a: o! R
C:\Documents and Settings\Administrator\1.cpp(58) : error C2018: unknown character '0xf8', Z6 r9 W6 {/ A3 B3 d) i1 v6 K
C:\Documents and Settings\Administrator\1.cpp(58) : error C2018: unknown character '0xc9'
- t+ M$ ]5 R; r0 dC:\Documents and Settings\Administrator\1.cpp(58) : error C2018: unknown character '0xcf'7 T* y2 e1 i( N* X4 }3 c
Error executing cl.exe.</P><>1.exe - 26 error(s), 3 warning(s)
) N9 |# L; ?: b" _$ p# g: U  p</P>
回复

使用道具 举报

ilikenba 实名认证       

1万

主题

49

听众

2万

积分

  • TA的每日心情
    奋斗
    2024-6-23 05:14
  • 签到天数: 1043 天

    [LV.10]以坛为家III

    社区QQ达人 新人进步奖 优秀斑竹奖 发帖功臣

    群组万里江山

    群组sas讨论小组

    群组长盛证券理财有限公司

    群组C 语言讨论组

    群组Matlab讨论组

    <>因为你是直接拷贝放在编译器里面执行的!这里网页上有一些不可见的控制符号!所以提示有非法字符!注意将一些空格重新输入一下就行了!</P>
    回复

    使用道具 举报

    您需要登录后才可以回帖 登录 | 注册地址

    qq
    收缩
    • 电话咨询

    • 04714969085
    fastpost

    关于我们| 联系我们| 诚征英才| 对外合作| 产品服务| QQ

    手机版|Archiver| |繁體中文 手机客户端  

    蒙公网安备 15010502000194号

    Powered by Discuz! X2.5   © 2001-2013 数学建模网-数学中国 ( 蒙ICP备14002410号-3 蒙BBS备-0002号 )     论坛法律顾问:王兆丰

    GMT+8, 2026-6-13 02:39 , Processed in 0.511232 second(s), 83 queries .

    回顶部