QQ登录

只需要一步,快速开始

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

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

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

17

主题

1

听众

109

积分

升级  4.5%

该用户从未签到

跳转到指定楼层
1#
发表于 2004-6-4 11:33 |只看该作者 |正序浏览
|招呼Ta 关注Ta
<>#include "process.h" 1 [8 A, k, h2 ?% g
#include "stdio.h"
  U( {) _2 B9 tint main(void)
# ~/ r% U3 A8 m3 R7 p{
6 v6 z2 @% {3 ~- rint i=0,count=0; ( X( C0 h; u' T
char c,aa[20],bb[10]="abc"; 2 M/ L) D! i) a* b) v
clrscr();
$ O8 _3 b1 f# m) J9 M6 Ktextbackground(1); . A! `8 I5 S$ y
textcolor(4);
* J. ?' X% g! p1 x/ \Loop:
7 L5 t2 N4 l) \: T5 j( Wgotoxy(25,12);
* r( O2 R! z& E) H1 ~5 t3 ~cprintf("Input your password:"); /*当然在这里输入要输入与bb[10]同样的值  */
+ H* _$ q+ T" Rwhile((c=getch())!=13)
7 _! O$ ^2 f3 x9 r{ ; @! K  _5 M- p- P* N" V8 L
aa[i++]=c; ) k4 B( j6 p# G8 c" h: d! ?% k# R
gotoxy(45+i,12);
& [6 S- a0 h7 scprintf("*");
/ H, v/ U1 K' k4 h% Q2 Bif(i&gt;20)
( r" F% O1 _. p# ?9 R# @break; / x: E. f& `* W* D& k! p% P! ?
} . j2 W+ ^  [  v; q, Q) @1 s
aa=0; 0 O/ m5 l2 O( H1 p( D4 p
if(strcmp(aa,bb)==0) - P5 v0 H8 A) ^7 Q* Q
{ 5 R2 W/ E# Y- o1 z
gotoxy(25,13); % _; X& q# \! F3 v9 K7 y$ Y- r* ~; {* y
cprintf("Your password input right!!!");
1 k" s: w# d+ S4 w+ g) Dgotoxy(25,14);( F2 Z' n4 Y# a2 W2 a. F
printf("the window will close,thank you");
2 ^/ B+ X3 l3 G, u2 Pdelay(10000000); % v/ v4 p. ?" U+ Q2 v" O
getch(); /*正确输入后,将退出其不意*/
# }: r& }/ O+ n: N, Eexit(0); ; g/ s) ?; i9 n( t0 ]
close(); 9 w" H: Q( d1 G4 j
}
* u9 t: e, k8 }else ! c5 }0 D9 a$ |
{ i=0; : X1 T7 Q& A7 P/ O
count++;
" l5 I3 M; B* b3 ^gotoxy(25,13); 0 |9 `2 Q! W/ e6 N& D6 W# e! J
cprintf("Your password input error!!!");   H) n0 N' A* P3 |2 R# s+ k
getch();
2 n5 i6 D. o2 [5 e{ 0 s  x1 J0 V$ ]$ J
gotoxy(25,14);
' F8 B1 ^% Q% b/ Q9 Hif(count&gt;3)
. f1 U; A9 @" K( ]7 k' O, d; H{
7 z  c; y8 N1 y3 Hcprintf("You put the wrong number too many times");</P>
2 L9 [& k3 T3 B4 D5 i& h' S; s5 S<>gotoxy(25,15);
- [" ]/ v3 d. s5 z+ K7 Ccprintf("so the computer must SHOUT DOWN!"); 5 V. x" B( X- o( ?4 c  u7 c
getch();" Q8 \& u! l" C5 n
exit(0);
, z5 F+ u: ~" T% aclose();$ c# ^' w+ Y% R+ d4 b9 K3 @
} ' A0 T& x  I6 p. W4 E
delay(10000000000);
" ^  a" |& {$ G; y. z( Z+ Eclrscr();/ _" l' S7 t9 ?4 S. T
goto Loop; . l- V' c2 {/ A/ h% A  S
}
0 S; m4 s8 \( l% p) P}
( Q. y8 h: L+ d! Bgetch() ;
0 y2 _! K7 d  @- z5 O}</P>
% M/ `$ R9 \: G  i  z. H0 e" Y4 ^<>              </P>
: l8 p% M7 d8 t: y! S0 Q2 t# |<>        来源---网上</P>
: T/ E' A4 E# p! ^+ x, W3 |9 p<>                                          </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
    1 B3 w& [# S! uC:\Documents and Settings\Administrator\1.cpp(7) : error C2065: 'clrscr' : undeclared identifier: E! h# N- Y, r# a
    C:\Documents and Settings\Administrator\1.cpp(8) : error C2065: 'textbackground' : undeclared identifier
    & o: {6 z) w: \; a& C' p# T. fC:\Documents and Settings\Administrator\1.cpp(9) : error C2065: 'textcolor' : undeclared identifier
    7 W1 {  V  k6 }5 C9 o4 `C:\Documents and Settings\Administrator\1.cpp(11) : error C2065: 'gotoxy' : undeclared identifier# {- s" D! z1 X9 q
    C:\Documents and Settings\Administrator\1.cpp(12) : error C2065: 'cprintf' : undeclared identifier
    % b2 i! I7 A+ m  R1 [1 Q  |* UC:\Documents and Settings\Administrator\1.cpp(13) : error C2065: 'getch' : undeclared identifier# `, o7 f. y$ R% L# \, R' G3 {
    C:\Documents and Settings\Administrator\1.cpp(18) : error C2065: 'gt' : undeclared identifier
    # b: `. o2 y0 n/ @C:\Documents and Settings\Administrator\1.cpp(18) : error C2143: syntax error : missing ')' before ';'
    3 [# K2 `+ O9 X6 v" M) I6 RC:\Documents and Settings\Administrator\1.cpp(18) : warning C4390: ';' : empty controlled statement found; is this the intent?
    ! V, l  t, E8 {: n4 eC:\Documents and Settings\Administrator\1.cpp(18) : error C2059: syntax error : ')', V2 X$ h: Y9 I) k" u/ b
    C:\Documents and Settings\Administrator\1.cpp(19) : error C2143: syntax error : missing ';' before 'break'$ b. Y$ \! E' E! b
    C:\Documents and Settings\Administrator\1.cpp(22) : error C2065: 'strcmp' : undeclared identifier
    & K! g0 U+ @! ~0 R0 {8 w. PC:\Documents and Settings\Administrator\1.cpp(28) : error C2065: 'delay' : undeclared identifier4 ~8 L- F0 G/ p9 F# }4 e2 D
    C:\Documents and Settings\Administrator\1.cpp(31) : error C2065: 'close' : undeclared identifier
    ( K0 [: ~# d& }6 S& x: _" GC:\Documents and Settings\Administrator\1.cpp(41) : error C2143: syntax error : missing ')' before ';'( }7 ^/ {- ]/ Z- @6 Q
    C:\Documents and Settings\Administrator\1.cpp(41) : warning C4390: ';' : empty controlled statement found; is this the intent?7 i+ f2 q3 Z8 E6 F! {
    C:\Documents and Settings\Administrator\1.cpp(41) : error C2059: syntax error : ')'7 X8 k1 f2 V( O; ?* X) o( D
    C:\Documents and Settings\Administrator\1.cpp(42) : error C2143: syntax error : missing ';' before '{'
    2 J  j- s! N6 B/ ^' q7 u! H( ~C:\Documents and Settings\Administrator\1.cpp(43) : error C2143: syntax error : missing ';' before '&lt;'2 c9 v7 `& [& p/ Q) s
    C:\Documents and Settings\Administrator\1.cpp(56) : warning C4508: 'main' : function should return a value; 'void' return type assumed( x/ P# [" i! S+ R9 K
    C:\Documents and Settings\Administrator\1.cpp(56) : error C2143: syntax error : missing ';' before '&lt;'
    ' _/ r0 S, q/ A: y  v& bC:\Documents and Settings\Administrator\1.cpp(58) : error C2018: unknown character '0xc0'
    ) Z* G* ]' _* |; u: JC:\Documents and Settings\Administrator\1.cpp(58) : error C2018: unknown character '0xb4'
    + v" ^, Q. z& C: Q1 q: R+ a4 @; CC:\Documents and Settings\Administrator\1.cpp(58) : error C2018: unknown character '0xd4'" c* v0 g& k! \9 y
    C:\Documents and Settings\Administrator\1.cpp(58) : error C2018: unknown character '0xb4'
    : N& ?" G. H& Q6 @) r1 K3 o7 aC:\Documents and Settings\Administrator\1.cpp(58) : error C2018: unknown character '0xcd'7 H! \% R( p2 q# t9 U6 x4 |
    C:\Documents and Settings\Administrator\1.cpp(58) : error C2018: unknown character '0xf8'% x' I. N, g$ O7 T, a
    C:\Documents and Settings\Administrator\1.cpp(58) : error C2018: unknown character '0xc9'4 b7 [1 o8 `; d  ^$ R2 M; d2 m
    C:\Documents and Settings\Administrator\1.cpp(58) : error C2018: unknown character '0xcf'
    2 B- {  @$ G+ e; jError executing cl.exe.</P><>1.exe - 26 error(s), 3 warning(s)
    0 V0 v& P( e6 W0 I  h7 Z</P>
    回复

    使用道具 举报

    solucky        

    17

    主题

    1

    听众

    109

    积分

    升级  4.5%

    该用户从未签到

    回复

    使用道具 举报

    pride        

    0

    主题

    1

    听众

    22

    积分

    升级  17.89%

    该用户从未签到

    新人进步奖

    <>不错不错,只是密码输入后,不能用“Backspace”修改。。</P><>我在里面填了几句,实现修改的功能。</P><> while((c=getch())!=13)
    % [# T4 G# S" q3 [+ F  {4 M3 C$ M' t/ I- V" Z
       if(c==8){i--;gotoxy(46+i,12);cprintf(" ");gotoxy(46+i,12);}
    2 N* F& g; Z/ U4 I& E   else{
    7 p2 i3 w- p7 M4 |7 U1 l: X! B   aa[i++]=c;0 s) c+ l2 [  ^$ I2 P: M4 t5 @: b2 i
       gotoxy(45+i,12);1 z5 V2 B8 r2 [7 m6 m3 m2 S& L- Z
       cprintf("*");
    6 ^: j! g( _. X% @  [   if(i&gt;20) break;}! }' z8 s$ V% w7 u  ^
      }</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-4-20 18:41 , Processed in 0.475022 second(s), 84 queries .

    回顶部