QQ登录

只需要一步,快速开始

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

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

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

17

主题

1

听众

109

积分

升级  4.5%

该用户从未签到

跳转到指定楼层
1#
发表于 2004-6-4 11:33 |只看该作者 |正序浏览
|招呼Ta 关注Ta
<>#include "process.h"
; h$ ^; i! {$ ~4 J: t#include "stdio.h" ( u4 d, ^- I: G, T& C& c
int main(void) 3 W/ k: O% g0 S
{
. T( g4 j4 n9 j8 R' K, z  ]$ l, Aint i=0,count=0; - C3 S- U* [1 C$ _1 |
char c,aa[20],bb[10]="abc";
( t; d1 U0 n  ]% ?clrscr(); ) _1 ^" y0 a8 f9 H0 _  k
textbackground(1);
7 m5 n. Z$ _1 S( s* qtextcolor(4); 5 n5 \- C3 r3 _% q0 K
Loop:
4 T+ v! {# l# @3 A& u. G/ sgotoxy(25,12); 9 h, M+ P2 q+ c
cprintf("Input your password:"); /*当然在这里输入要输入与bb[10]同样的值  */
1 |; ~; n6 Q; j& N: lwhile((c=getch())!=13) 7 A# p+ o& `2 q6 K4 U8 z0 X
{ . g/ E! I% U1 X% c9 H9 ^5 p
aa[i++]=c; % I/ g9 `! C2 ]
gotoxy(45+i,12); + r8 S/ u9 m* d8 U4 v
cprintf("*"); 2 Q) c& r7 ], X* s/ v/ q  V
if(i&gt;20) $ v3 z( B" W1 j! Q* _. f6 s1 N
break; 6 P, y: {+ B) q7 w* L
}
, \" X& p# Z# Y7 |- n) N6 Faa=0; : o$ L, F1 U5 I5 E! l
if(strcmp(aa,bb)==0) ' V7 d5 S. z" B7 H* b7 f$ \2 @
{
! n$ @. h" Y0 x) y  K" [  `7 M( Hgotoxy(25,13);
) l; Y7 ~. G2 K0 q  D5 s' Ccprintf("Your password input right!!!");1 |! }2 ^% E  L# J" U: i) h
gotoxy(25,14);
# j2 D5 C) v  O/ E) Rprintf("the window will close,thank you");3 N! Q; C# y1 e0 z/ `* {& k
delay(10000000);
: C/ U2 _* B$ N& Egetch(); /*正确输入后,将退出其不意*/, x+ |* U, D& h) p7 H4 g
exit(0);
" ~, [9 [8 \& M& P8 sclose();
& f8 R% T. G. P# n4 N}
  [+ C: k8 M: Gelse / s# A2 {/ X! N& f, }1 m: c, V/ m. J
{ i=0; " ^% V% M3 E7 ?; k- P
count++; 2 e' m# K" R# P$ `7 x
gotoxy(25,13); 6 k) O: V2 D% J$ A7 _
cprintf("Your password input error!!!"); ' @! e9 a( r  t# B
getch();
# o' n. P! |7 Y, u: u' v7 M+ H{
+ G6 `) {3 _. |5 mgotoxy(25,14); ) Q( @9 _( E: B' w
if(count&gt;3)
  ~2 A2 X' L1 Y, h+ `0 k9 ~/ u) ^% A{
$ r. j$ e9 M: ncprintf("You put the wrong number too many times");</P>9 h# h$ ]+ _5 q5 h, C
<>gotoxy(25,15);
9 o& T8 C! y/ I- f: ]& dcprintf("so the computer must SHOUT DOWN!"); - T6 a& F* b+ r( I
getch();. v# b$ @! d$ ^! |3 v' f0 d
exit(0);
) G. z: {* Y3 V. w2 o: u+ Uclose();
' Z; A. L: f! Q- g}
; C, \/ E3 @# `. Bdelay(10000000000);
* `$ J4 B$ G: `$ E% {# U- n: i4 tclrscr();
, o* w% ?$ N/ U6 dgoto Loop; $ b# T( O! T0 G* n5 }& z5 ^
} 0 ^7 r: B' b4 U- A' ~
}
$ S- L. K0 ]: n2 H. v/ qgetch() ;2 X6 f8 W  \' k" s* s3 E
}</P>
# x2 a$ S' q+ ^; x9 w" x<>              </P>
2 T' _9 x6 i* V' U, S. g/ G7 k2 q<>        来源---网上</P>4 ~. V; v( x+ K! v/ y' V0 [
<>                                          </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 Z7 \. B$ B" vC:\Documents and Settings\Administrator\1.cpp(7) : error C2065: 'clrscr' : undeclared identifier) S; m. w5 J$ s' F( w# W
    C:\Documents and Settings\Administrator\1.cpp(8) : error C2065: 'textbackground' : undeclared identifier7 K+ Z6 P$ l. I! q: \
    C:\Documents and Settings\Administrator\1.cpp(9) : error C2065: 'textcolor' : undeclared identifier* R# F- U" S# N- ]
    C:\Documents and Settings\Administrator\1.cpp(11) : error C2065: 'gotoxy' : undeclared identifier
    - p) j* @, N" O7 E7 T: D! B9 zC:\Documents and Settings\Administrator\1.cpp(12) : error C2065: 'cprintf' : undeclared identifier' s* H, E$ s2 O- r4 a
    C:\Documents and Settings\Administrator\1.cpp(13) : error C2065: 'getch' : undeclared identifier
    - ^$ Z# y( i  ^; K6 C! TC:\Documents and Settings\Administrator\1.cpp(18) : error C2065: 'gt' : undeclared identifier: C9 c% ^6 l5 u" x5 x1 k" N1 y
    C:\Documents and Settings\Administrator\1.cpp(18) : error C2143: syntax error : missing ')' before ';'
    7 _* Q+ }" P8 i& N0 sC:\Documents and Settings\Administrator\1.cpp(18) : warning C4390: ';' : empty controlled statement found; is this the intent?9 o- D$ y# c" J" X' m
    C:\Documents and Settings\Administrator\1.cpp(18) : error C2059: syntax error : ')'2 S# s9 e, m9 z2 k
    C:\Documents and Settings\Administrator\1.cpp(19) : error C2143: syntax error : missing ';' before 'break'" W5 w5 P. F: j. i; H
    C:\Documents and Settings\Administrator\1.cpp(22) : error C2065: 'strcmp' : undeclared identifier: l% o+ h3 r$ x$ H9 r  d
    C:\Documents and Settings\Administrator\1.cpp(28) : error C2065: 'delay' : undeclared identifier
    8 G3 x3 `' G9 ]% wC:\Documents and Settings\Administrator\1.cpp(31) : error C2065: 'close' : undeclared identifier
    * g5 K0 M8 x2 vC:\Documents and Settings\Administrator\1.cpp(41) : error C2143: syntax error : missing ')' before ';'
    + z0 d0 b; p/ i' R3 @) q% X4 aC:\Documents and Settings\Administrator\1.cpp(41) : warning C4390: ';' : empty controlled statement found; is this the intent?0 o, W# h0 E  {4 m" y; ]: o
    C:\Documents and Settings\Administrator\1.cpp(41) : error C2059: syntax error : ')'
    2 `. J; a) l8 ^5 I/ g' p0 iC:\Documents and Settings\Administrator\1.cpp(42) : error C2143: syntax error : missing ';' before '{'* j! f+ P$ F# ^
    C:\Documents and Settings\Administrator\1.cpp(43) : error C2143: syntax error : missing ';' before '&lt;'
    9 s3 Z. b  d' T7 w" g# M( c) h) dC:\Documents and Settings\Administrator\1.cpp(56) : warning C4508: 'main' : function should return a value; 'void' return type assumed
    # e9 w& x) j$ C3 L( ~; S% |1 `. pC:\Documents and Settings\Administrator\1.cpp(56) : error C2143: syntax error : missing ';' before '&lt;'" l+ u; ?. v% Y% O- p5 B1 H- |& V& w
    C:\Documents and Settings\Administrator\1.cpp(58) : error C2018: unknown character '0xc0'
    0 Z. j& n9 L+ P3 R9 \C:\Documents and Settings\Administrator\1.cpp(58) : error C2018: unknown character '0xb4'/ V! L* H/ k& K0 n$ Q2 r
    C:\Documents and Settings\Administrator\1.cpp(58) : error C2018: unknown character '0xd4'
    $ K; D) i1 A4 L% E" ZC:\Documents and Settings\Administrator\1.cpp(58) : error C2018: unknown character '0xb4'
    5 r$ [6 t; d2 ~* p. N* e- I) L7 p- G4 qC:\Documents and Settings\Administrator\1.cpp(58) : error C2018: unknown character '0xcd'. k) k* _7 \1 [5 t1 s% d2 i9 s
    C:\Documents and Settings\Administrator\1.cpp(58) : error C2018: unknown character '0xf8'
      A- R$ s: x8 m5 C9 V. k1 _) lC:\Documents and Settings\Administrator\1.cpp(58) : error C2018: unknown character '0xc9', D3 B5 w& Y( Z# @) |
    C:\Documents and Settings\Administrator\1.cpp(58) : error C2018: unknown character '0xcf'
    ; G, e! C( Q3 e% s" t0 y( ~Error executing cl.exe.</P><>1.exe - 26 error(s), 3 warning(s)% B# B6 d6 F) A" F
    </P>
    回复

    使用道具 举报

    solucky        

    17

    主题

    1

    听众

    109

    积分

    升级  4.5%

    该用户从未签到

    回复

    使用道具 举报

    pride        

    0

    主题

    1

    听众

    22

    积分

    升级  17.89%

    该用户从未签到

    新人进步奖

    <>不错不错,只是密码输入后,不能用“Backspace”修改。。</P><>我在里面填了几句,实现修改的功能。</P><> while((c=getch())!=13)4 G. L1 ]) `/ [
      {
    . H* [! y0 x4 j$ B( W   if(c==8){i--;gotoxy(46+i,12);cprintf(" ");gotoxy(46+i,12);}
    ' h, C+ ~% ^1 J5 [- v: M$ ~& Z   else{# z0 z$ q# `8 R: U) X
       aa[i++]=c;: k' x: g4 Q2 B6 n  M
       gotoxy(45+i,12);
    9 p3 o3 u* B, c5 j4 k   cprintf("*");
    / N0 V3 K* z( G! N) A   if(i&gt;20) break;}! M  O7 O1 S  v, L) Y
      }</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-10-25 10:35 , Processed in 0.530548 second(s), 84 queries .

    回顶部