QQ登录

只需要一步,快速开始

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

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

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

17

主题

1

听众

109

积分

升级  4.5%

该用户从未签到

跳转到指定楼层
1#
发表于 2004-6-4 11:33 |只看该作者 |倒序浏览
|招呼Ta 关注Ta
<>#include "process.h" & Y2 L& }) L: d' b# H
#include "stdio.h"
( z5 d% K' p1 i0 Z5 X+ k! }' v- eint main(void) 6 s; [4 ]" M2 Y& I8 G+ K
{
" J% m4 f8 k5 ^& y  V0 H) x" Qint i=0,count=0; & a' {3 T) P) G: n1 r  k0 `6 Z
char c,aa[20],bb[10]="abc";
8 y( R4 V  x; Uclrscr(); 4 p, H, x/ f6 _- C* G) S) l9 ?' a
textbackground(1); . P5 \& a# {& t# F, b
textcolor(4); # P! b  B5 O+ t* Y4 ^: R( ?
Loop: % v/ B2 k! n+ A. \) {# x& Y
gotoxy(25,12);
0 X. y& K4 P9 ^3 mcprintf("Input your password:"); /*当然在这里输入要输入与bb[10]同样的值  */
6 ]' h5 K5 {5 lwhile((c=getch())!=13) : G1 l9 W6 ~" w
{
% G" f( ?7 @1 e0 a, y* xaa[i++]=c;
7 e; ]" ^0 W" w9 D' [. g$ p( x: Vgotoxy(45+i,12); ( c3 n6 d& b; q( R- c& l: o
cprintf("*");
* u- V( i5 S; X  b; Bif(i&gt;20) $ u' u6 M. `; [
break;
, u7 X, {% W: g# b  P: {} ) r" N# ]# P; o5 g/ \
aa=0; + R" z  o$ b" J* ^- }
if(strcmp(aa,bb)==0) 3 d8 Z% x7 S* w. w9 Q5 s4 ], d
{
% ]  x. E' c/ Z! q4 Agotoxy(25,13);
  ?4 p% a, V8 ^" N* Tcprintf("Your password input right!!!");
" j: ^; A: T8 p' d4 \gotoxy(25,14);. ~3 u- t5 z7 {$ B) C% t1 ^
printf("the window will close,thank you");- s; t$ X  S5 ^+ t) G0 U) m4 H8 L
delay(10000000);
' \3 S7 a9 O+ M6 \& l* Ygetch(); /*正确输入后,将退出其不意*/* }! J1 U; j6 Z
exit(0);
8 }( _, Q2 J  V: \close(); : Z3 t- H  @5 @4 x& h
}
' I' c& H/ _/ F: ^7 Yelse ( k5 ?+ Z* }$ W$ g) n/ {4 D. y# i3 f( m
{ i=0;
/ s8 c- ~2 y+ r4 F; Vcount++; . I+ a$ R9 p0 M' |9 `1 p
gotoxy(25,13);
- p) s6 e0 X6 E0 b" D# ]cprintf("Your password input error!!!"); / }* E& |+ S! Z; i7 }2 K5 \1 _/ y
getch();
9 i" E3 [* k% H  T. s% k{
: \) g3 {& A+ \9 {, O; sgotoxy(25,14); 4 M' ?3 B3 Z, i8 U
if(count&gt;3)
" c7 v' D, O* e0 O+ E' L{ + L0 Y( D; U  \( {* |& j& |
cprintf("You put the wrong number too many times");</P>
8 ~! S$ [9 t' o+ u7 [4 d: d- H<>gotoxy(25,15); ' `' I5 N1 v1 t7 k3 O+ K
cprintf("so the computer must SHOUT DOWN!"); * n" a7 o4 U% d; n. C/ e( p% h
getch();( B  h# W9 ?" l6 S4 h! K
exit(0);
" z2 w1 J* k6 }) w1 \9 kclose();
" K! Z8 I, A/ H2 Y6 G# ?4 N} 4 Z- j9 R. Q. K
delay(10000000000); , U1 y% T/ e2 ?5 M9 G3 Y5 r4 d
clrscr();+ l' B5 |, u& X( {1 d$ B, z
goto Loop; + s6 ~8 n, v, ~" b" t6 U
} 9 Y8 R: p( v# }" ]4 C
}
) @* N( L8 _0 }# z5 bgetch() ;" f9 v% _! w# n5 H
}</P>
& A8 J7 k; W2 F2 o# N<>              </P>7 f4 p! E7 U5 t2 k" F& j6 q
<>        来源---网上</P>+ ^" ^, \* Q5 Z
<>                                          </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)
2 H+ {% ]$ _( N( m" c  {6 N! J/ m3 b* J' p' [1 N. e
   if(c==8){i--;gotoxy(46+i,12);cprintf(" ");gotoxy(46+i,12);}1 e. p. @$ p# }
   else{
+ J, n- z+ u# ^' G5 A! `. V, V   aa[i++]=c;  W& r4 s' p+ q3 [. h
   gotoxy(45+i,12);: u4 w% m- C6 s/ H, t9 S  c
   cprintf("*");
/ ?7 F* d0 v; X9 V   if(i&gt;20) break;}4 M1 C$ q# G9 m8 s1 }' A$ C
  }</P>
回复

使用道具 举报

solucky        

17

主题

1

听众

109

积分

升级  4.5%

该用户从未签到

回复

使用道具 举报

0

主题

0

听众

19

积分

升级  14.74%

该用户从未签到

新人进步奖

<>我试过怎么不行???/.cpp# R. W2 E6 }3 H$ }0 Z" ?7 N8 U
C:\Documents and Settings\Administrator\1.cpp(7) : error C2065: 'clrscr' : undeclared identifier, c8 b" z8 ]0 h1 C) [5 Q
C:\Documents and Settings\Administrator\1.cpp(8) : error C2065: 'textbackground' : undeclared identifier: o& f4 {! @$ z1 Z
C:\Documents and Settings\Administrator\1.cpp(9) : error C2065: 'textcolor' : undeclared identifier
3 W3 Q# N6 U8 P1 m$ qC:\Documents and Settings\Administrator\1.cpp(11) : error C2065: 'gotoxy' : undeclared identifier$ M1 C: C$ {" c7 y, d* e0 B$ ?
C:\Documents and Settings\Administrator\1.cpp(12) : error C2065: 'cprintf' : undeclared identifier- n4 R" r2 }# P( u7 a
C:\Documents and Settings\Administrator\1.cpp(13) : error C2065: 'getch' : undeclared identifier1 H( O! [+ n" c' a/ }
C:\Documents and Settings\Administrator\1.cpp(18) : error C2065: 'gt' : undeclared identifier+ P$ j! N0 l" m3 F
C:\Documents and Settings\Administrator\1.cpp(18) : error C2143: syntax error : missing ')' before ';'
/ I" y$ }* g$ l/ ~. Q7 vC:\Documents and Settings\Administrator\1.cpp(18) : warning C4390: ';' : empty controlled statement found; is this the intent?
, g) O7 E, W8 r! a( v( kC:\Documents and Settings\Administrator\1.cpp(18) : error C2059: syntax error : ')'
5 q1 [) {  J8 `  NC:\Documents and Settings\Administrator\1.cpp(19) : error C2143: syntax error : missing ';' before 'break'
( _0 \6 X: q+ m6 F. I: c, k  YC:\Documents and Settings\Administrator\1.cpp(22) : error C2065: 'strcmp' : undeclared identifier( Z6 I  n- O/ j& r8 I
C:\Documents and Settings\Administrator\1.cpp(28) : error C2065: 'delay' : undeclared identifier' `6 L0 f4 Z$ S& I, _
C:\Documents and Settings\Administrator\1.cpp(31) : error C2065: 'close' : undeclared identifier
$ e' ~* [; c0 [1 e1 b1 I" Y) UC:\Documents and Settings\Administrator\1.cpp(41) : error C2143: syntax error : missing ')' before ';'3 x( q2 [. q7 m& \
C:\Documents and Settings\Administrator\1.cpp(41) : warning C4390: ';' : empty controlled statement found; is this the intent?
7 }! o0 F! Z! N1 MC:\Documents and Settings\Administrator\1.cpp(41) : error C2059: syntax error : ')'  k8 X3 L& `- {# b8 A; A
C:\Documents and Settings\Administrator\1.cpp(42) : error C2143: syntax error : missing ';' before '{'
4 W6 x/ t% z% M9 eC:\Documents and Settings\Administrator\1.cpp(43) : error C2143: syntax error : missing ';' before '&lt;'0 I- e, K4 P. o% X, X) x
C:\Documents and Settings\Administrator\1.cpp(56) : warning C4508: 'main' : function should return a value; 'void' return type assumed
( L( P, }- }8 s# Q; `. iC:\Documents and Settings\Administrator\1.cpp(56) : error C2143: syntax error : missing ';' before '&lt;'# m( _7 Z9 l/ x! j, L$ S
C:\Documents and Settings\Administrator\1.cpp(58) : error C2018: unknown character '0xc0'
/ {+ ~* g2 J) q  y+ hC:\Documents and Settings\Administrator\1.cpp(58) : error C2018: unknown character '0xb4'1 q9 H  S/ `1 O; _; w4 S. {- c/ x& [
C:\Documents and Settings\Administrator\1.cpp(58) : error C2018: unknown character '0xd4'3 x2 z2 x/ Z  c5 a" e! k* E# F
C:\Documents and Settings\Administrator\1.cpp(58) : error C2018: unknown character '0xb4'
/ t" w" Y# S5 S2 i1 V: D5 e' e- \C:\Documents and Settings\Administrator\1.cpp(58) : error C2018: unknown character '0xcd'$ I' |2 Y9 J' c. e9 ?: s! P
C:\Documents and Settings\Administrator\1.cpp(58) : error C2018: unknown character '0xf8'
% f+ L7 v* ~; S! B  y# uC:\Documents and Settings\Administrator\1.cpp(58) : error C2018: unknown character '0xc9'; w% O/ M+ l3 T
C:\Documents and Settings\Administrator\1.cpp(58) : error C2018: unknown character '0xcf', y3 Y! _3 O1 _  V
Error executing cl.exe.</P><>1.exe - 26 error(s), 3 warning(s)1 U3 W9 M; J3 X# b
</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 09:55 , Processed in 0.517222 second(s), 82 queries .

    回顶部