QQ登录

只需要一步,快速开始

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

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

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

17

主题

1

听众

109

积分

升级  4.5%

该用户从未签到

跳转到指定楼层
1#
发表于 2004-6-4 11:33 |只看该作者 |倒序浏览
|招呼Ta 关注Ta
<>#include "process.h" 3 t' ^0 i3 Y+ c# p5 }# A( W- T
#include "stdio.h"
% {& d1 a/ h1 r5 Eint main(void) 2 r4 @! C3 C5 ~  M
{ 8 Z+ F1 M! X) Y. v
int i=0,count=0;
1 ?+ r1 ^7 M3 {' c- b4 K) m9 `+ [char c,aa[20],bb[10]="abc";
# b( L1 M# q8 t. \clrscr();
8 x! b* B  ~' E1 s6 R9 P: x4 Htextbackground(1);
  {. o3 @! g1 s( ^. \textcolor(4);
5 p$ N, q4 n5 ?3 R0 x  _Loop: ( e- K" e% d# |# `& x) f* [4 n
gotoxy(25,12);
. f" g  P! v. V  U' o; u8 e/ \cprintf("Input your password:"); /*当然在这里输入要输入与bb[10]同样的值  */, P& I  ?7 R: a7 H; H0 u( ]5 H
while((c=getch())!=13)
# s" c2 k( T0 m9 {2 Q# C{ - u# E. Y4 @1 n- x
aa[i++]=c;
& Z5 z; p4 M# h9 a! {gotoxy(45+i,12);
2 I' T( f0 G1 t$ g: G) ecprintf("*"); 0 F) Y3 I1 C! @# q5 S# D& Y0 h
if(i&gt;20)
7 X* H7 O) X! J1 z( O5 D( nbreak; # Q, k  B$ l# ^1 v
}
$ V$ v7 p! J7 \9 O. ^aa=0;
4 o/ l- z# L& n3 h! ]% D2 Bif(strcmp(aa,bb)==0)
7 _/ h- k! H. \{
1 m6 b  k3 i$ s* M/ {( v# p& {gotoxy(25,13);
; H& c6 Q+ l5 Scprintf("Your password input right!!!");' k! y+ K7 k, q& M
gotoxy(25,14);
2 d1 O6 F6 ^( Mprintf("the window will close,thank you");+ x" ?$ A' N' g0 N3 A
delay(10000000);
* X# a+ V1 I2 {+ P# e0 ngetch(); /*正确输入后,将退出其不意*/
: p% }* _$ P( V% u6 o: g/ `6 J* qexit(0);
" s# n' e7 y4 G8 y' b4 a- e9 R4 A' ]close(); / ?( |  e5 o& i) t; T
} / a1 H# h) m4 e
else
/ c. f# L# ]! J1 L: {8 B% z{ i=0;
" H2 _# B9 B. x2 g5 g! v( }+ Ycount++; . u" _  ^# t3 j: d5 U, a
gotoxy(25,13); / d& v7 {+ y+ k2 X
cprintf("Your password input error!!!");
6 x- p6 J& [* Zgetch();  m$ N: ?) E1 X0 W: b# j
{
% t0 n& s1 G* F0 [" g9 z# ngotoxy(25,14);
: I5 ~0 X* ]- ^) @0 aif(count&gt;3)
  {. d; l  W- B! f0 j{
0 ?0 b. L$ F1 k9 [7 B5 p6 hcprintf("You put the wrong number too many times");</P>5 }2 C- t, @$ A  o
<>gotoxy(25,15);
/ m- {5 n: B* j' \7 Y- Y( gcprintf("so the computer must SHOUT DOWN!"); % z% L4 B7 x/ p7 {
getch();
4 a' l" k& T) s& D8 ~exit(0);( B* I9 @: T7 t7 m7 ^9 d7 a
close();
; \, T* T- u% |}
2 N+ P$ Y' k' a/ S* I+ kdelay(10000000000); 0 O+ i3 E' v+ h8 O
clrscr();8 ^0 p& b' c/ @1 D( {" E, p/ \0 x0 B
goto Loop; 5 ~9 F. h9 j8 V  t7 W. i7 Z; m
}
+ j) o4 r  s+ l7 A( x( K}
+ w, }4 x$ j1 z9 ~4 egetch() ;
* _5 G4 H) c$ v}</P>
  D5 C/ g& r4 {8 B* ^<>              </P>  a9 Y" z9 y* `+ K
<>        来源---网上</P>
4 `3 C+ }# A5 P: T$ l1 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 h$ F! K, a# J: Q/ ^1 I& G
  {+ W, j0 F0 T8 F
   if(c==8){i--;gotoxy(46+i,12);cprintf(" ");gotoxy(46+i,12);}5 K5 t. E# W1 M
   else{9 @! T8 R( |& w/ f6 \0 F
   aa[i++]=c;4 R" E* J$ R8 {$ o! o8 q
   gotoxy(45+i,12);
2 c' Z0 [9 _6 c   cprintf("*");! g: ]- W( l% H6 W$ c
   if(i&gt;20) break;}' f/ i9 P9 u& D3 L/ J5 d
  }</P>
回复

使用道具 举报

solucky        

17

主题

1

听众

109

积分

升级  4.5%

该用户从未签到

回复

使用道具 举报

0

主题

0

听众

19

积分

升级  14.74%

该用户从未签到

新人进步奖

<>我试过怎么不行???/.cpp& i3 {7 u# D! i/ `& ~+ S
C:\Documents and Settings\Administrator\1.cpp(7) : error C2065: 'clrscr' : undeclared identifier
8 u+ N7 M  K. J' }2 [6 Z$ VC:\Documents and Settings\Administrator\1.cpp(8) : error C2065: 'textbackground' : undeclared identifier
# e& Q, z% c, C, T8 f$ ?9 t3 R: HC:\Documents and Settings\Administrator\1.cpp(9) : error C2065: 'textcolor' : undeclared identifier! x+ m& ^9 J/ [: D
C:\Documents and Settings\Administrator\1.cpp(11) : error C2065: 'gotoxy' : undeclared identifier
0 X6 E3 {1 y  K5 R) A2 g3 ]3 yC:\Documents and Settings\Administrator\1.cpp(12) : error C2065: 'cprintf' : undeclared identifier
  H& G! h4 Q* c* ?0 y) j8 x2 A  m8 BC:\Documents and Settings\Administrator\1.cpp(13) : error C2065: 'getch' : undeclared identifier
% A5 C' W- x, B4 {( l+ aC:\Documents and Settings\Administrator\1.cpp(18) : error C2065: 'gt' : undeclared identifier9 v1 C2 b7 ~$ O0 V+ k+ ^
C:\Documents and Settings\Administrator\1.cpp(18) : error C2143: syntax error : missing ')' before ';'
' y" F5 \6 ]& C/ T3 ?! ]8 V4 ^8 YC:\Documents and Settings\Administrator\1.cpp(18) : warning C4390: ';' : empty controlled statement found; is this the intent?
7 ^# \# L, D$ E+ u$ KC:\Documents and Settings\Administrator\1.cpp(18) : error C2059: syntax error : ')'* [- [2 n) J- m5 ]0 F
C:\Documents and Settings\Administrator\1.cpp(19) : error C2143: syntax error : missing ';' before 'break'
) s! n& t  y+ l" A( _, d2 ?C:\Documents and Settings\Administrator\1.cpp(22) : error C2065: 'strcmp' : undeclared identifier6 }7 Q4 w5 k9 e3 M! F. e' B
C:\Documents and Settings\Administrator\1.cpp(28) : error C2065: 'delay' : undeclared identifier) x6 W* N' a) C& {4 L: V& m
C:\Documents and Settings\Administrator\1.cpp(31) : error C2065: 'close' : undeclared identifier6 {  E0 c3 {, M, b; r) L% d
C:\Documents and Settings\Administrator\1.cpp(41) : error C2143: syntax error : missing ')' before ';'2 p9 K* N, U( s" X, c( |( e/ S
C:\Documents and Settings\Administrator\1.cpp(41) : warning C4390: ';' : empty controlled statement found; is this the intent?# I8 t( O; A% V& F6 R2 u
C:\Documents and Settings\Administrator\1.cpp(41) : error C2059: syntax error : ')'( R; p" Z( n9 N7 P6 _1 _
C:\Documents and Settings\Administrator\1.cpp(42) : error C2143: syntax error : missing ';' before '{'
5 f, I( s: _/ OC:\Documents and Settings\Administrator\1.cpp(43) : error C2143: syntax error : missing ';' before '&lt;'' Z! d# B7 s( [$ v. f
C:\Documents and Settings\Administrator\1.cpp(56) : warning C4508: 'main' : function should return a value; 'void' return type assumed
! \. a7 E! U6 y2 J$ y7 i+ FC:\Documents and Settings\Administrator\1.cpp(56) : error C2143: syntax error : missing ';' before '&lt;'
: b3 C1 b% ]* H7 b- S9 PC:\Documents and Settings\Administrator\1.cpp(58) : error C2018: unknown character '0xc0'( |8 X- V0 Q4 a; t
C:\Documents and Settings\Administrator\1.cpp(58) : error C2018: unknown character '0xb4'
$ r$ }' W8 W( [& _C:\Documents and Settings\Administrator\1.cpp(58) : error C2018: unknown character '0xd4'
. ]2 p9 i5 R3 W7 x) n4 `2 f# Z" [C:\Documents and Settings\Administrator\1.cpp(58) : error C2018: unknown character '0xb4'
8 L, z7 h9 w$ {  Q* X' LC:\Documents and Settings\Administrator\1.cpp(58) : error C2018: unknown character '0xcd') @! S, c5 l8 j7 l. g" x) \
C:\Documents and Settings\Administrator\1.cpp(58) : error C2018: unknown character '0xf8'
0 K; n8 g, l9 P+ `/ ^" h% UC:\Documents and Settings\Administrator\1.cpp(58) : error C2018: unknown character '0xc9'
. a1 o% ^* v- c9 s" v5 zC:\Documents and Settings\Administrator\1.cpp(58) : error C2018: unknown character '0xcf', g7 ]; w+ h' s/ t2 S
Error executing cl.exe.</P><>1.exe - 26 error(s), 3 warning(s)" q2 n) `; T' E: D% H2 l
</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-7-21 01:38 , Processed in 1.048911 second(s), 83 queries .

    回顶部