QQ登录

只需要一步,快速开始

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

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

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

17

主题

1

听众

109

积分

升级  4.5%

该用户从未签到

跳转到指定楼层
1#
发表于 2004-6-4 11:33 |只看该作者 |正序浏览
|招呼Ta 关注Ta
<>#include "process.h"
- K5 y1 W3 _7 M) k#include "stdio.h" ( W& v+ [7 @9 g' f8 k0 j$ y& U
int main(void) ' a; f+ R4 e3 [" b* i
{
& @: F6 Z, Q8 f9 Z0 Tint i=0,count=0; & T/ @4 S- J/ q, M6 @* ], V
char c,aa[20],bb[10]="abc"; 3 c* s) M# |* _
clrscr(); 9 h! A+ w( G) w/ D. `" j
textbackground(1); 1 k6 b' j5 L3 d+ ^
textcolor(4); . a+ k1 F. `& H4 D% L
Loop:
3 |# p6 z1 K& e) K: i2 h' S  Tgotoxy(25,12);
- {- m4 q4 y8 D9 g! \cprintf("Input your password:"); /*当然在这里输入要输入与bb[10]同样的值  */* k9 H# I, F3 B* a; n8 e
while((c=getch())!=13)
& Y6 N( E( k. V# _# m, L' j{
, L% F0 c5 P. w/ O" f; S; n( T9 paa[i++]=c; 1 V3 U9 F9 f4 A4 b% U* F
gotoxy(45+i,12); % |. @4 v- T4 A8 l8 t7 h# h* G
cprintf("*"); 2 b  L1 _8 u: J3 B- n$ l) s
if(i&gt;20) , N  T8 _6 y  I: c5 p/ E  e2 k
break;
/ G4 S5 E& C  t) [- r* l3 `} ; j2 z5 {9 z) Y* R
aa=0;
' E4 f3 T3 B0 _: f, uif(strcmp(aa,bb)==0) 9 n0 z& @. X$ S# i
{
4 x  I3 L! Z5 d2 Z1 c! V6 cgotoxy(25,13);
: l6 V: M, F( B' m) D) Z3 b- X4 Scprintf("Your password input right!!!");! W, l  c$ W) J0 k* @2 w
gotoxy(25,14);
0 C# n" B: V7 ~1 hprintf("the window will close,thank you");
$ A# ^; p# q8 m% Jdelay(10000000);
# x7 T. A- _3 _# w+ Ngetch(); /*正确输入后,将退出其不意*/
9 ^9 a1 d% Z: X! ]+ z! A9 B0 Lexit(0);
; m7 I! C% b; j5 Yclose();
, b7 S9 e1 B; K5 V5 h- ]: I; w4 `} % y, M& Y" W0 q) w8 ^5 c7 [
else 0 w% ?8 u6 j, E, q9 [( P
{ i=0; 7 H' a! J# v7 h8 Q
count++; $ S. r: N+ E/ _' d- e
gotoxy(25,13);
. A- \$ }9 V& W- Tcprintf("Your password input error!!!");
8 y7 T  k; d0 T- Qgetch();
  G5 f. k- [+ S9 r{
  N3 D- I2 h$ ?# Kgotoxy(25,14);
) a; E% o0 l3 n$ {3 Q& F0 G7 t2 wif(count&gt;3)
# r( z7 a7 y8 y, z- d{ 3 W6 S5 G  J3 n' o
cprintf("You put the wrong number too many times");</P>6 Q  d9 s3 c, p0 }, I
<>gotoxy(25,15); # Q% t' V. @, p
cprintf("so the computer must SHOUT DOWN!"); 0 b) D: p5 K( t6 H" L) w
getch();
1 S. m+ i4 v9 G& A( p  ]& uexit(0);
* J0 K6 H8 ]+ w$ M5 dclose();: e' i% r8 h; N) {! r. v  K
}
& h' T* b0 Q5 E, K4 a# y( ?delay(10000000000); 0 b& o7 @" ~+ I1 ]6 `0 S
clrscr();
; n- t. x5 ?1 `! B8 Tgoto Loop;
& `( t' N. f- ]# m}
- ~; N6 p2 o8 Q} : P& F" N& g$ ]7 O
getch() ;3 L' T# q, H4 @0 X( r: c( G
}</P>) H3 ^- c. G* C, c- R
<>              </P>
  }6 t' U3 Z4 Y# r7 c8 q<>        来源---网上</P>
- ]9 ]$ z8 v' x* D& S4 H+ z. j<>                                          </P>
zan
转播转播0 分享淘帖0 分享分享0 收藏收藏0 支持支持0 反对反对0 微信微信
笑一笑 只牵动苦涩的嘴角 我的寂寞谁知道 我害怕 用真心面对这世界 只好越来越沉默
ilikenba 实名认证       

1万

主题

49

听众

2万

积分

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

    [LV.10]以坛为家III

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

    群组万里江山

    群组sas讨论小组

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

    群组C 语言讨论组

    群组Matlab讨论组

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

    使用道具 举报

    0

    主题

    0

    听众

    19

    积分

    升级  14.74%

    该用户从未签到

    新人进步奖

    <>我试过怎么不行???/.cpp
    2 ~; A3 w; c+ T3 O4 Y. lC:\Documents and Settings\Administrator\1.cpp(7) : error C2065: 'clrscr' : undeclared identifier
    : C* h- Y+ K; t2 iC:\Documents and Settings\Administrator\1.cpp(8) : error C2065: 'textbackground' : undeclared identifier1 H* I* z5 I) \5 q
    C:\Documents and Settings\Administrator\1.cpp(9) : error C2065: 'textcolor' : undeclared identifier0 E: C5 M& f& Q4 `' m
    C:\Documents and Settings\Administrator\1.cpp(11) : error C2065: 'gotoxy' : undeclared identifier
    , G# a% E9 e# f+ {2 VC:\Documents and Settings\Administrator\1.cpp(12) : error C2065: 'cprintf' : undeclared identifier8 ^1 G5 `- Q  t3 h5 a+ |/ H; p
    C:\Documents and Settings\Administrator\1.cpp(13) : error C2065: 'getch' : undeclared identifier
    . J" }- U* n+ w, B8 WC:\Documents and Settings\Administrator\1.cpp(18) : error C2065: 'gt' : undeclared identifier
    $ r4 |" z0 G5 H8 R; }) ?1 A- M) CC:\Documents and Settings\Administrator\1.cpp(18) : error C2143: syntax error : missing ')' before ';'
    . }( Q( F: H, \$ S5 |' `7 e) PC:\Documents and Settings\Administrator\1.cpp(18) : warning C4390: ';' : empty controlled statement found; is this the intent?
    5 Z6 S- c1 n3 x1 G) L6 @C:\Documents and Settings\Administrator\1.cpp(18) : error C2059: syntax error : ')'7 Q7 B2 o1 g8 U
    C:\Documents and Settings\Administrator\1.cpp(19) : error C2143: syntax error : missing ';' before 'break'0 Y% R& H/ ~$ n6 ]* ^. c
    C:\Documents and Settings\Administrator\1.cpp(22) : error C2065: 'strcmp' : undeclared identifier- W" o/ h6 s) o; L0 j
    C:\Documents and Settings\Administrator\1.cpp(28) : error C2065: 'delay' : undeclared identifier
    8 i. L6 ^# S2 H) j, z2 {' jC:\Documents and Settings\Administrator\1.cpp(31) : error C2065: 'close' : undeclared identifier
    ; ~* Y% E, l& w0 [9 dC:\Documents and Settings\Administrator\1.cpp(41) : error C2143: syntax error : missing ')' before ';'
    ' o# F1 ?) w8 g: J* B' uC:\Documents and Settings\Administrator\1.cpp(41) : warning C4390: ';' : empty controlled statement found; is this the intent?% F+ V0 j7 _0 N) O$ p
    C:\Documents and Settings\Administrator\1.cpp(41) : error C2059: syntax error : ')'
    ) b: f! K$ {! D8 N9 }C:\Documents and Settings\Administrator\1.cpp(42) : error C2143: syntax error : missing ';' before '{'- K  w0 H# y% p( V7 p8 S
    C:\Documents and Settings\Administrator\1.cpp(43) : error C2143: syntax error : missing ';' before '&lt;'2 x6 t$ k2 p* [! q2 [; x
    C:\Documents and Settings\Administrator\1.cpp(56) : warning C4508: 'main' : function should return a value; 'void' return type assumed
      r! y/ q0 u, y! |" M( ~6 b" \; S' \C:\Documents and Settings\Administrator\1.cpp(56) : error C2143: syntax error : missing ';' before '&lt;'
    " p" e- Q7 W  UC:\Documents and Settings\Administrator\1.cpp(58) : error C2018: unknown character '0xc0'
    6 r9 F& @" B' H& fC:\Documents and Settings\Administrator\1.cpp(58) : error C2018: unknown character '0xb4'
    6 l, \. w* l+ P9 }8 i# y( oC:\Documents and Settings\Administrator\1.cpp(58) : error C2018: unknown character '0xd4'
    5 o" x  |: A& W/ vC:\Documents and Settings\Administrator\1.cpp(58) : error C2018: unknown character '0xb4'
    * q' q1 x& {$ Z5 I" B5 T3 nC:\Documents and Settings\Administrator\1.cpp(58) : error C2018: unknown character '0xcd'
    % u; u' q0 o5 U4 _/ g* u% m4 L, CC:\Documents and Settings\Administrator\1.cpp(58) : error C2018: unknown character '0xf8'7 d1 r$ i& Z0 G/ y) T
    C:\Documents and Settings\Administrator\1.cpp(58) : error C2018: unknown character '0xc9'0 z1 `, N4 i; w. ?! A& c
    C:\Documents and Settings\Administrator\1.cpp(58) : error C2018: unknown character '0xcf'
    / t. ^% z" o/ r8 ^- {8 o, kError executing cl.exe.</P><>1.exe - 26 error(s), 3 warning(s)
    : ^7 r. g  q" z* n8 r! x! O</P>
    回复

    使用道具 举报

    solucky        

    17

    主题

    1

    听众

    109

    积分

    升级  4.5%

    该用户从未签到

    回复

    使用道具 举报

    pride        

    0

    主题

    1

    听众

    22

    积分

    升级  17.89%

    该用户从未签到

    新人进步奖

    <>不错不错,只是密码输入后,不能用“Backspace”修改。。</P><>我在里面填了几句,实现修改的功能。</P><> while((c=getch())!=13)
    . o! N% C( W% {5 b; j  {
    ( K3 Y4 m3 z5 q" L& ?  U; C) I   if(c==8){i--;gotoxy(46+i,12);cprintf(" ");gotoxy(46+i,12);}
    0 f0 `0 P% R: B0 h+ w! u- Z   else{' N  h4 K- K2 N0 d: y
       aa[i++]=c;
    8 d% {& n% q3 E" Y8 z" F   gotoxy(45+i,12);
    ' w) U: q, m$ L! Y   cprintf("*");
    # x4 ?. P+ ?8 q: F; d   if(i&gt;20) break;}4 v; q3 _7 f+ {# f" F  ~
      }</P>
    回复

    使用道具 举报

    1

    主题

    0

    听众

    25

    积分

    升级  21.05%

    该用户从未签到

    新人进步奖

    回复

    使用道具 举报

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

    qq
    收缩
    • 电话咨询

    • 04714969085
    fastpost

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

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

    蒙公网安备 15010502000194号

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

    GMT+8, 2026-6-13 04:11 , Processed in 0.495401 second(s), 85 queries .

    回顶部