QQ登录

只需要一步,快速开始

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

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

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

17

主题

1

听众

109

积分

升级  4.5%

该用户从未签到

跳转到指定楼层
1#
发表于 2004-6-4 11:33 |只看该作者 |倒序浏览
|招呼Ta 关注Ta
<>#include "process.h" ! F$ q& h. ~+ M) z5 U' M# X# @5 N
#include "stdio.h" 6 W8 o1 I. P2 }- _% |" {$ u! m
int main(void) * U& h# J1 ^7 i! Z
{ 1 _7 J2 m) B$ M
int i=0,count=0;
1 u/ \. P* e' B9 p5 Ichar c,aa[20],bb[10]="abc";
( U* s  s# h- U9 F% |clrscr();
+ s3 n: U+ c9 u& x  c3 ytextbackground(1);
/ j5 J* u0 `+ o2 a' \+ X+ Etextcolor(4); 8 _( h. P# n/ ~, F, C5 Y
Loop: : @6 D# l: H# L  g9 L: `# c
gotoxy(25,12);
2 A2 h* d; V& J9 |1 }cprintf("Input your password:"); /*当然在这里输入要输入与bb[10]同样的值  */' m& n3 _; K0 f% E0 H! n" M8 t% ?& \
while((c=getch())!=13) $ G. g; ^$ N. h, `0 i) C
{
! r  k+ ?0 R& E2 _aa[i++]=c;
- d! C/ `) k* s& B  kgotoxy(45+i,12);
5 _. q6 S; `! [: y- x& o. _8 Ecprintf("*");
1 X9 c" V! N' mif(i&gt;20)
! ~1 E' Q+ `* l6 i6 M2 V7 ?break;
8 r$ \# @3 O$ h% @2 E}
3 F+ g3 @3 T% b2 n5 H( daa=0;
% Z& |' j& u  J5 Jif(strcmp(aa,bb)==0) 8 ]2 n0 S" f3 _$ J8 H4 o* X
{ 7 t. T+ W" ^: r& Q
gotoxy(25,13);
# x) J9 {5 k( L/ u7 L- ^cprintf("Your password input right!!!");9 f5 P" Z& E, a7 e
gotoxy(25,14);
$ d2 @  ~% t3 n+ B6 }printf("the window will close,thank you");
! _9 d$ U% e3 p7 y: Kdelay(10000000);
7 Z1 o6 `8 Z7 b% c* B0 Egetch(); /*正确输入后,将退出其不意*/
# r* F, A" Y8 J; y" z, A' p8 e) d9 B; pexit(0); + P; E. I5 j' Q( L) \& j3 t- a, R' ]
close(); 7 v& u; f. B  [9 {" Z$ ?
} 6 I" r# @( O+ a7 A  D+ L
else
+ x& {8 @8 @6 }* ]: Z3 J{ i=0; 2 f' R/ {: S7 H' {6 V& b
count++;
, o, J* H/ d3 G1 Igotoxy(25,13); ' D: G$ L+ I9 i+ S1 V
cprintf("Your password input error!!!");
) q) `! C* P* I  I' g0 Ggetch();2 d" J, S! s) w/ Q6 J
{
! _$ V  t/ [3 _. x- Ngotoxy(25,14); 9 K0 ~! L( s+ c6 T. f( B1 a
if(count&gt;3)
* c8 E7 i% {3 x0 J- N{ , H: R3 a/ {  x0 a2 p# v
cprintf("You put the wrong number too many times");</P>
, w) A- K# x! m& p: Z( Z<>gotoxy(25,15); & f; k1 O$ ~+ X% [( b
cprintf("so the computer must SHOUT DOWN!"); / M& n) e' F  U' E
getch();4 ]! e8 Y& ]0 B2 E" ]# o: |
exit(0);* K# r) q6 O4 Y  P& A! l1 e
close();  d; F) J5 o8 t/ }) C/ o! U
} # d# ?% b8 F3 j. g# _
delay(10000000000);
3 h, B3 s, R5 R, |clrscr();
( L% Z! N, Z4 w! ^- Wgoto Loop;
) H" B0 b3 e. h, |/ w2 f}
; b) g3 A5 Q% W. t" M' g6 @3 I# P; i} 5 o4 {( X/ Z9 b# \5 W1 X0 M
getch() ;
/ ?. c8 D, c) G/ e3 G' [& ^}</P>
6 K$ H' Z3 _1 S8 J<>              </P>( }' T: `- O8 q: {8 M: C; E
<>        来源---网上</P>9 _6 h) r8 A8 B1 |% J, k4 [; W( j
<>                                          </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)
3 g7 a3 M2 G/ w  {9 H) @& W8 J+ U2 _9 O" C& r- R* z, [5 z
   if(c==8){i--;gotoxy(46+i,12);cprintf(" ");gotoxy(46+i,12);}
. t0 b- u9 c. Y! V   else{
! z6 C2 ]% _3 i4 X$ s8 J  d   aa[i++]=c;
1 I# k/ c; O4 Y( G$ G' i   gotoxy(45+i,12);
$ M: c) v  u% e1 e/ E% ?   cprintf("*");, ?" I) m& B1 W5 c) G/ E! J, V
   if(i&gt;20) break;}" ~, A9 `- W) W$ b  u1 p
  }</P>
回复

使用道具 举报

solucky        

17

主题

1

听众

109

积分

升级  4.5%

该用户从未签到

回复

使用道具 举报

0

主题

0

听众

19

积分

升级  14.74%

该用户从未签到

新人进步奖

<>我试过怎么不行???/.cpp6 a: M$ n% ^: M4 H7 S: V+ A0 w' D( P
C:\Documents and Settings\Administrator\1.cpp(7) : error C2065: 'clrscr' : undeclared identifier
7 y7 w# ?- G9 T8 v* gC:\Documents and Settings\Administrator\1.cpp(8) : error C2065: 'textbackground' : undeclared identifier; A# Z1 T! |- c! x) f, d
C:\Documents and Settings\Administrator\1.cpp(9) : error C2065: 'textcolor' : undeclared identifier- I4 m8 b1 b  n- K& g; c8 n/ }( k1 o
C:\Documents and Settings\Administrator\1.cpp(11) : error C2065: 'gotoxy' : undeclared identifier
) w& e( m/ v8 P9 }8 KC:\Documents and Settings\Administrator\1.cpp(12) : error C2065: 'cprintf' : undeclared identifier9 s) f1 J: ^0 B: E4 \" ^, q2 W
C:\Documents and Settings\Administrator\1.cpp(13) : error C2065: 'getch' : undeclared identifier
  Q8 n- \( u1 W/ Z" WC:\Documents and Settings\Administrator\1.cpp(18) : error C2065: 'gt' : undeclared identifier
7 z, e9 E2 x% p$ u1 |' tC:\Documents and Settings\Administrator\1.cpp(18) : error C2143: syntax error : missing ')' before ';'8 Q, _3 s2 y- Y
C:\Documents and Settings\Administrator\1.cpp(18) : warning C4390: ';' : empty controlled statement found; is this the intent?
0 _0 c2 U2 Y3 W! Y# h7 D2 NC:\Documents and Settings\Administrator\1.cpp(18) : error C2059: syntax error : ')'
# _5 x* J; D2 OC:\Documents and Settings\Administrator\1.cpp(19) : error C2143: syntax error : missing ';' before 'break'1 |2 h% t2 ~* U9 h$ L7 x
C:\Documents and Settings\Administrator\1.cpp(22) : error C2065: 'strcmp' : undeclared identifier
( W) K3 [& X) H& L. ~' ?- dC:\Documents and Settings\Administrator\1.cpp(28) : error C2065: 'delay' : undeclared identifier
# q! {! @* v0 y( a7 i; ^+ [C:\Documents and Settings\Administrator\1.cpp(31) : error C2065: 'close' : undeclared identifier
$ j& w& d! a; {: Z5 QC:\Documents and Settings\Administrator\1.cpp(41) : error C2143: syntax error : missing ')' before ';'2 E. N7 R" o8 [( Z# E
C:\Documents and Settings\Administrator\1.cpp(41) : warning C4390: ';' : empty controlled statement found; is this the intent?
3 t5 O* f" b3 o& a9 ^C:\Documents and Settings\Administrator\1.cpp(41) : error C2059: syntax error : ')'
" U" D7 {9 _1 AC:\Documents and Settings\Administrator\1.cpp(42) : error C2143: syntax error : missing ';' before '{'
" G+ I5 ]* n3 v$ p( @+ ?1 k: f# LC:\Documents and Settings\Administrator\1.cpp(43) : error C2143: syntax error : missing ';' before '&lt;'
! U6 I9 `9 G8 Y* G8 A* LC:\Documents and Settings\Administrator\1.cpp(56) : warning C4508: 'main' : function should return a value; 'void' return type assumed& E3 l. j, y8 O/ w
C:\Documents and Settings\Administrator\1.cpp(56) : error C2143: syntax error : missing ';' before '&lt;'5 `% b7 K) I- G
C:\Documents and Settings\Administrator\1.cpp(58) : error C2018: unknown character '0xc0'  Y! F9 F5 b  B- S0 i8 h9 E5 x! ^
C:\Documents and Settings\Administrator\1.cpp(58) : error C2018: unknown character '0xb4'
: Z7 M* D1 t  \  QC:\Documents and Settings\Administrator\1.cpp(58) : error C2018: unknown character '0xd4'
4 F) l. M: T$ k9 [% k3 M) d+ vC:\Documents and Settings\Administrator\1.cpp(58) : error C2018: unknown character '0xb4'
2 \+ V4 J* o2 |  Z8 l8 B9 yC:\Documents and Settings\Administrator\1.cpp(58) : error C2018: unknown character '0xcd'
0 A5 E) I) d: V" x  }$ s" @+ OC:\Documents and Settings\Administrator\1.cpp(58) : error C2018: unknown character '0xf8': V. e+ u( F& Q7 u
C:\Documents and Settings\Administrator\1.cpp(58) : error C2018: unknown character '0xc9'; n8 ~: z  l! G" ~
C:\Documents and Settings\Administrator\1.cpp(58) : error C2018: unknown character '0xcf'7 ^8 t- q" t4 D$ @+ k
Error executing cl.exe.</P><>1.exe - 26 error(s), 3 warning(s)
+ A3 I8 Z7 p! J! J7 `</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-4-20 10:03 , Processed in 0.435823 second(s), 83 queries .

    回顶部