QQ登录

只需要一步,快速开始

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

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

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

17

主题

1

听众

109

积分

升级  4.5%

该用户从未签到

跳转到指定楼层
1#
发表于 2004-6-4 11:33 |只看该作者 |倒序浏览
|招呼Ta 关注Ta
<>#include "process.h" * b3 h. ]% U" A
#include "stdio.h"
0 v/ J! J1 t5 \# }1 p# zint main(void) 6 b+ F+ ^- N6 _
{ 0 {6 c, i' `. g3 o9 e9 W  U
int i=0,count=0; * V. e; J8 d' C# A9 D8 Z4 S
char c,aa[20],bb[10]="abc"; , m7 T- t* M2 r+ S8 M
clrscr(); ! J  t9 R8 r+ p5 m5 Z% E
textbackground(1); ! w. l! b, B+ ]& E+ _# i$ ]
textcolor(4);
/ H+ J' D- p( q" x6 ^" eLoop:
$ Y4 u2 u- D1 t3 l6 w5 ~gotoxy(25,12);
9 _6 N6 v1 Q: w; H7 u+ Zcprintf("Input your password:"); /*当然在这里输入要输入与bb[10]同样的值  */
4 s/ K, [! ]  H& f( b) qwhile((c=getch())!=13)
2 Y) T  W, B1 p6 T! e, D/ S- ?{ ; o' Y8 U/ {9 G
aa[i++]=c;
/ I* A) ?, y: _gotoxy(45+i,12); % n0 ?" Z7 Q( W' G; E9 V
cprintf("*"); * r0 W2 n. U3 o4 s9 w) J
if(i&gt;20) & }% z2 e) ~/ O" r" n
break; 7 C1 d. @5 O3 M/ I# b+ G
}
# q$ `: V5 M6 F  p8 g- maa=0; . }/ l! q. i1 x/ K/ M+ I
if(strcmp(aa,bb)==0) 1 X% n/ }9 j- y$ ~9 E; H! ^
{
  P8 V9 j' X6 Z5 T$ wgotoxy(25,13); , L: ^, }) ?+ v; e
cprintf("Your password input right!!!");+ s1 q: e% X% m9 J$ B/ s: Z" H
gotoxy(25,14);9 W  \4 X% ?/ e1 o, {
printf("the window will close,thank you");
" s: h8 W7 B- ^' j  a" Ldelay(10000000); 0 X1 h9 s" m6 K* c0 X
getch(); /*正确输入后,将退出其不意*/, J6 g0 Y) V% q& C) N' b% o
exit(0); / I4 ]- s9 c# v6 y- M
close(); ! w; g: a2 X$ ?+ m6 H* s, J; Q' }. O" b
}
7 u9 R5 S. h6 }7 u" @* relse
# A) V2 j) o# R; I{ i=0; 7 D: Y. D$ t) J; g0 w7 ~; E
count++;
, i/ W: k7 h; Z/ `& Egotoxy(25,13); 8 e7 @7 p9 {( n! b0 x. n
cprintf("Your password input error!!!"); 1 O; X+ t4 e, W& z6 r8 W' j
getch();4 k3 w9 P7 t) P& n
{
) {! g& E, ~  y( ~% jgotoxy(25,14);
" z: T/ o, q1 I' A6 t3 Vif(count&gt;3) 0 o2 m, |5 _! Z% g
{ % q' ?" b. }+ y( N1 d2 m
cprintf("You put the wrong number too many times");</P>5 C6 E2 |1 V8 P# m+ m
<>gotoxy(25,15);
/ [% |* i" R" ^3 M+ R! {4 ccprintf("so the computer must SHOUT DOWN!");
# f1 F" ^( L2 m3 i2 H% n. z- w  }& i8 dgetch();. [$ A# B, q) @1 X
exit(0);
& m  t5 W/ I% Mclose();
- K  ?9 {$ G! o* z9 Q. F}
" L% s; Z; @; @delay(10000000000); # M9 F7 d4 _5 d5 I7 a+ V1 \- P0 S
clrscr();
+ p: C/ K; @. E% z( |# [3 x# sgoto Loop; ) t" _3 z# E6 S4 v
}
# J6 C5 a1 @; P5 G7 p( B}
8 o& M2 Y. D& t: m9 z! n4 o& a' hgetch() ;, ~4 N  g- I+ G4 Q
}</P>5 O6 c6 f  a; a0 A
<>              </P>) _' o, ?( y1 K5 Q$ b0 O. A
<>        来源---网上</P>" P5 B0 S5 V) P, T3 f" U# M
<>                                          </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)
4 s4 {% U% U6 K7 c  {
2 v# D( J! H4 t: F& l. j$ Z7 `* b. X9 R   if(c==8){i--;gotoxy(46+i,12);cprintf(" ");gotoxy(46+i,12);}
# n0 x' r, x+ i" w/ p   else{
: [6 U& k) O5 W9 i6 h* e   aa[i++]=c;- L* ~+ O3 u  B# ^7 d) }' o
   gotoxy(45+i,12);8 D" G& t. b. V. N
   cprintf("*");
8 ]7 r9 n/ K  X9 e6 @( R% Z   if(i&gt;20) break;}7 B6 p) h9 ^6 ~6 h
  }</P>
回复

使用道具 举报

solucky        

17

主题

1

听众

109

积分

升级  4.5%

该用户从未签到

回复

使用道具 举报

0

主题

0

听众

19

积分

升级  14.74%

该用户从未签到

新人进步奖

<>我试过怎么不行???/.cpp( A  T  ]) x8 q: l
C:\Documents and Settings\Administrator\1.cpp(7) : error C2065: 'clrscr' : undeclared identifier0 T  }) }! q) P+ t+ k' a& t0 j
C:\Documents and Settings\Administrator\1.cpp(8) : error C2065: 'textbackground' : undeclared identifier: \8 N. e7 Y, q+ i5 V
C:\Documents and Settings\Administrator\1.cpp(9) : error C2065: 'textcolor' : undeclared identifier
) j& ^; C6 q! K/ {- kC:\Documents and Settings\Administrator\1.cpp(11) : error C2065: 'gotoxy' : undeclared identifier! G* x5 u' m: U
C:\Documents and Settings\Administrator\1.cpp(12) : error C2065: 'cprintf' : undeclared identifier
, X# P2 ]0 M7 IC:\Documents and Settings\Administrator\1.cpp(13) : error C2065: 'getch' : undeclared identifier- h( N1 b8 z) ]7 l
C:\Documents and Settings\Administrator\1.cpp(18) : error C2065: 'gt' : undeclared identifier
, O4 J: {) m0 y! b, DC:\Documents and Settings\Administrator\1.cpp(18) : error C2143: syntax error : missing ')' before ';'
: |  V6 y$ h) IC:\Documents and Settings\Administrator\1.cpp(18) : warning C4390: ';' : empty controlled statement found; is this the intent?' Q2 E9 R0 |6 m3 W$ N& X# Z9 B
C:\Documents and Settings\Administrator\1.cpp(18) : error C2059: syntax error : ')'
9 V6 F7 R6 z: j& cC:\Documents and Settings\Administrator\1.cpp(19) : error C2143: syntax error : missing ';' before 'break'7 [- t& J1 {% T! t- K! I0 R
C:\Documents and Settings\Administrator\1.cpp(22) : error C2065: 'strcmp' : undeclared identifier  [2 Z$ O3 n0 m& A6 v4 k5 }, \
C:\Documents and Settings\Administrator\1.cpp(28) : error C2065: 'delay' : undeclared identifier
" v- M7 _, h6 d5 }/ m" L; p. nC:\Documents and Settings\Administrator\1.cpp(31) : error C2065: 'close' : undeclared identifier
) m/ E; q5 K& tC:\Documents and Settings\Administrator\1.cpp(41) : error C2143: syntax error : missing ')' before ';'
* G( |8 |( S2 d' WC:\Documents and Settings\Administrator\1.cpp(41) : warning C4390: ';' : empty controlled statement found; is this the intent?: `, u! U9 l5 C8 F. W& n- J3 g
C:\Documents and Settings\Administrator\1.cpp(41) : error C2059: syntax error : ')': }  a6 Y1 R- R; T, A" i
C:\Documents and Settings\Administrator\1.cpp(42) : error C2143: syntax error : missing ';' before '{'
& `' |- \% `) Q8 R$ PC:\Documents and Settings\Administrator\1.cpp(43) : error C2143: syntax error : missing ';' before '&lt;'
1 g) Y7 y5 H7 M- W0 |3 J: b7 LC:\Documents and Settings\Administrator\1.cpp(56) : warning C4508: 'main' : function should return a value; 'void' return type assumed* j8 e' _7 O3 t; U8 W8 n+ v
C:\Documents and Settings\Administrator\1.cpp(56) : error C2143: syntax error : missing ';' before '&lt;'
' Y4 l: R( {& vC:\Documents and Settings\Administrator\1.cpp(58) : error C2018: unknown character '0xc0'
& ]6 y) d# g2 R2 L! t  J# CC:\Documents and Settings\Administrator\1.cpp(58) : error C2018: unknown character '0xb4'
& _) U. h; n7 w  M3 R! ?+ vC:\Documents and Settings\Administrator\1.cpp(58) : error C2018: unknown character '0xd4', J; l8 N" R7 R3 e- S
C:\Documents and Settings\Administrator\1.cpp(58) : error C2018: unknown character '0xb4'7 B3 ]5 b% w  p6 B- w9 }
C:\Documents and Settings\Administrator\1.cpp(58) : error C2018: unknown character '0xcd'
8 n0 S8 `0 j+ i  F; p) UC:\Documents and Settings\Administrator\1.cpp(58) : error C2018: unknown character '0xf8'; s7 o0 c: C% a. G
C:\Documents and Settings\Administrator\1.cpp(58) : error C2018: unknown character '0xc9'- l4 s5 ^' N' D0 k3 P' t/ W- N
C:\Documents and Settings\Administrator\1.cpp(58) : error C2018: unknown character '0xcf'
* G# h  g; c3 S7 h: e0 h: [Error executing cl.exe.</P><>1.exe - 26 error(s), 3 warning(s)
2 n: D2 ?+ b- ^, Z</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 14:50 , Processed in 0.472431 second(s), 88 queries .

    回顶部