QQ登录

只需要一步,快速开始

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

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

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

17

主题

1

听众

109

积分

升级  4.5%

该用户从未签到

跳转到指定楼层
1#
发表于 2004-6-4 11:33 |只看该作者 |倒序浏览
|招呼Ta 关注Ta
<>#include "process.h"
9 i* Q+ h" ?* L9 }# T#include "stdio.h" & x% c0 C  }1 ?6 _
int main(void)
- d  \3 ]1 Z4 K2 G/ ]# I0 ]{
, m8 T6 S2 p: _int i=0,count=0;
1 ]  N" x; d5 U& A( N5 r* Ochar c,aa[20],bb[10]="abc";
! n! f0 B1 U) G, e7 k1 ~clrscr();
2 i+ I3 i+ r1 E+ u! Otextbackground(1); 0 r2 Q0 [3 v' ?" x. \; W$ ]: m
textcolor(4); 0 O; Q5 |9 R+ h2 H
Loop: 6 N3 _( ]: o. Y/ _& X3 C! M$ p; _+ C
gotoxy(25,12); / ?! q2 S, o) C7 T! M6 r- K
cprintf("Input your password:"); /*当然在这里输入要输入与bb[10]同样的值  */# j, u9 B. B. {+ e& F# W6 }% N
while((c=getch())!=13) 6 t. O- e& c, p5 H& G
{ , e  a  U1 R. f  s/ }1 y
aa[i++]=c;
$ U7 g, k- P/ C% D% _- l2 {gotoxy(45+i,12); ; N4 x$ D+ f, {
cprintf("*");
8 z( R8 P) f3 i  _if(i&gt;20)
# L4 L! y9 y' z0 @break; 0 @; Z) a; i5 W. e! D! \9 N
}
) h/ g7 F$ r4 G6 a, o$ Saa=0;
/ [/ G: I* E" G+ vif(strcmp(aa,bb)==0)
, M2 l' ^% ^7 g4 k; c1 y6 r{
2 `7 K8 [3 r6 b2 t6 p: d" agotoxy(25,13); , c; S6 f  M; j) z
cprintf("Your password input right!!!");/ w! z( d5 f1 X! c* E  E
gotoxy(25,14);3 ]4 L8 ?+ K1 `8 W* F" z
printf("the window will close,thank you");
$ Y& ^8 i, C* `" s3 jdelay(10000000); 0 q. D/ g. u* b; X% _
getch(); /*正确输入后,将退出其不意*/
) {: e1 s, J  s6 h( Yexit(0);
+ z" C) ^% I$ a' {( M# B  qclose(); 7 \: R6 i/ v  b( p) q. P3 b
}
, O" m( ~" _( p6 F: }; s6 d' Eelse
$ Y. M/ o, }/ a$ I1 D{ i=0;
  }, P7 x3 @) ?0 V4 Lcount++;
; n1 p3 k8 C* Z" }gotoxy(25,13);
/ C# Q/ W# s) ]: Z' B) H; Hcprintf("Your password input error!!!");
! v2 T# b3 s8 }, ^getch();
2 G* E# ~* M+ Z- e6 G2 F{ 8 x% o$ T2 F7 g% i
gotoxy(25,14);
% c. V+ N2 a3 R7 I& ]5 Aif(count&gt;3) 3 ~" \4 g6 A, ]3 d, K2 s, M
{
" o( M. T4 i$ fcprintf("You put the wrong number too many times");</P>
: [+ N0 a+ n% p) H1 Q3 Y<>gotoxy(25,15);
9 ?; n+ T8 e+ Y% O1 w% U, Acprintf("so the computer must SHOUT DOWN!");
% S% _( t  x$ Q9 a. X* B/ A2 Egetch();. b3 F7 n4 ?4 U% ]
exit(0);
& [$ r! u8 t4 f  n, X9 Y1 ~9 {/ iclose();
) g+ k' q3 f2 x: N2 T- }}
# _9 N. \% r; Q  H& Z7 c& w  Jdelay(10000000000);
+ S2 V! b. M, G/ \+ Z' nclrscr();: O: T# Q0 V# \4 {7 Q
goto Loop;
. N. l3 |8 a( s5 D: F5 f) P; A} , f+ {4 \1 c! O) r
}
7 l- `/ S$ @2 Jgetch() ;3 |: c* |2 z# @1 I8 Q: x
}</P>
  Q9 l4 W- H. p<>              </P>" r( q( y3 D8 w1 \5 ~/ O7 S$ A
<>        来源---网上</P>' J) g) @- S+ \( y& t
<>                                          </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)
0 q$ J) o, f, a  {& n0 T0 m0 e3 ~# b: ]& a3 _# h3 v
   if(c==8){i--;gotoxy(46+i,12);cprintf(" ");gotoxy(46+i,12);}
. J. Y5 G  ]: i# f) S   else{! C* Q" J: k; M( U
   aa[i++]=c;
# n. D& B- ]7 @; `! P3 E0 C6 a   gotoxy(45+i,12);8 X' a8 Y9 x! D+ ^7 F" C
   cprintf("*");5 o. N- ^; c! H  g# d4 C
   if(i&gt;20) break;}
. x! q6 l" y; @0 ?: s. h  \  }</P>
回复

使用道具 举报

solucky        

17

主题

1

听众

109

积分

升级  4.5%

该用户从未签到

回复

使用道具 举报

0

主题

0

听众

19

积分

升级  14.74%

该用户从未签到

新人进步奖

<>我试过怎么不行???/.cpp
1 v  k/ m, c) _) O/ CC:\Documents and Settings\Administrator\1.cpp(7) : error C2065: 'clrscr' : undeclared identifier" _8 u" H6 x9 c& S, s9 W
C:\Documents and Settings\Administrator\1.cpp(8) : error C2065: 'textbackground' : undeclared identifier  e( J  t: S8 L$ |
C:\Documents and Settings\Administrator\1.cpp(9) : error C2065: 'textcolor' : undeclared identifier+ X7 I, X- k2 I" d) z
C:\Documents and Settings\Administrator\1.cpp(11) : error C2065: 'gotoxy' : undeclared identifier/ @7 ?3 p. H: ^6 I, O" P3 z
C:\Documents and Settings\Administrator\1.cpp(12) : error C2065: 'cprintf' : undeclared identifier" n" U( V! C& U9 @4 s" s
C:\Documents and Settings\Administrator\1.cpp(13) : error C2065: 'getch' : undeclared identifier
" D1 d# p, K2 r. `7 E2 zC:\Documents and Settings\Administrator\1.cpp(18) : error C2065: 'gt' : undeclared identifier5 u& J" u" N! [) Z5 b7 y
C:\Documents and Settings\Administrator\1.cpp(18) : error C2143: syntax error : missing ')' before ';'
3 r9 W1 [; c& ^# n! @C:\Documents and Settings\Administrator\1.cpp(18) : warning C4390: ';' : empty controlled statement found; is this the intent?
! I$ m( k% T2 D; _C:\Documents and Settings\Administrator\1.cpp(18) : error C2059: syntax error : ')'
7 e- t% K6 @  C7 h' d# M7 l1 OC:\Documents and Settings\Administrator\1.cpp(19) : error C2143: syntax error : missing ';' before 'break'
7 `' @2 d% O9 U3 }/ i3 I' wC:\Documents and Settings\Administrator\1.cpp(22) : error C2065: 'strcmp' : undeclared identifier* w/ D; W7 J/ J$ H
C:\Documents and Settings\Administrator\1.cpp(28) : error C2065: 'delay' : undeclared identifier
2 c( x$ f1 T9 A0 D- r. cC:\Documents and Settings\Administrator\1.cpp(31) : error C2065: 'close' : undeclared identifier# m) ]$ _7 D, n3 O  D
C:\Documents and Settings\Administrator\1.cpp(41) : error C2143: syntax error : missing ')' before ';'
: l3 \7 R9 N* u. r+ ?C:\Documents and Settings\Administrator\1.cpp(41) : warning C4390: ';' : empty controlled statement found; is this the intent?
8 f& f/ X' `: a: |9 T) {C:\Documents and Settings\Administrator\1.cpp(41) : error C2059: syntax error : ')'
) z) |; M4 k8 H9 C' g9 @C:\Documents and Settings\Administrator\1.cpp(42) : error C2143: syntax error : missing ';' before '{'' W6 l- V7 h, p: R+ O" A
C:\Documents and Settings\Administrator\1.cpp(43) : error C2143: syntax error : missing ';' before '&lt;'# h5 P6 h* X2 c
C:\Documents and Settings\Administrator\1.cpp(56) : warning C4508: 'main' : function should return a value; 'void' return type assumed
! G6 p" l1 t" [3 F) I: oC:\Documents and Settings\Administrator\1.cpp(56) : error C2143: syntax error : missing ';' before '&lt;'
; Q9 s: `; d. _/ a$ V5 tC:\Documents and Settings\Administrator\1.cpp(58) : error C2018: unknown character '0xc0'5 e5 x' F9 K$ y0 l5 k& x' i* s
C:\Documents and Settings\Administrator\1.cpp(58) : error C2018: unknown character '0xb4'- e+ F- y' v  R8 d' @
C:\Documents and Settings\Administrator\1.cpp(58) : error C2018: unknown character '0xd4', c0 J9 c1 w1 g% v* t
C:\Documents and Settings\Administrator\1.cpp(58) : error C2018: unknown character '0xb4'
0 a' T$ v& ~! [- w: B) IC:\Documents and Settings\Administrator\1.cpp(58) : error C2018: unknown character '0xcd'
! q% g5 w/ B: y% Y) ?C:\Documents and Settings\Administrator\1.cpp(58) : error C2018: unknown character '0xf8'2 Q  ^' r) n5 Q! \" @* A/ m0 g
C:\Documents and Settings\Administrator\1.cpp(58) : error C2018: unknown character '0xc9'6 N8 k* U/ A# }5 L
C:\Documents and Settings\Administrator\1.cpp(58) : error C2018: unknown character '0xcf'
4 ~6 s( M5 ~+ yError executing cl.exe.</P><>1.exe - 26 error(s), 3 warning(s)
3 Q1 M: n# S: X$ N0 l- u</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-10-25 13:10 , Processed in 1.004075 second(s), 83 queries .

    回顶部