QQ登录

只需要一步,快速开始

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

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

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

17

主题

1

听众

109

积分

升级  4.5%

该用户从未签到

跳转到指定楼层
1#
发表于 2004-6-4 11:33 |只看该作者 |倒序浏览
|招呼Ta 关注Ta
<>#include "process.h"
; C( w( p2 G" P$ j6 Z#include "stdio.h"
" j1 `8 _4 \: P( T) ~0 xint main(void)
: C) ^  n$ \  t{
3 r5 ~% R+ w# x+ U, Hint i=0,count=0;
& B9 U) [8 x; C) F% [' ^char c,aa[20],bb[10]="abc";
  }& Q  J$ O: D$ jclrscr();
2 ?( D6 ~8 G  b( H7 v6 [textbackground(1); 2 N/ S) T  M2 A0 q
textcolor(4);
4 y4 s6 L( ~- ZLoop:
$ @9 [  P2 Y! b' Wgotoxy(25,12); # T8 y5 \& B& k
cprintf("Input your password:"); /*当然在这里输入要输入与bb[10]同样的值  */
$ s8 E: f4 t0 X6 R9 Jwhile((c=getch())!=13) , s/ }1 E- {2 v7 t9 s" l+ X3 L
{ 8 E7 i! P2 C. w9 U* j0 \3 R3 U1 R
aa[i++]=c;
! I8 p9 d1 H4 X: Xgotoxy(45+i,12); ! q3 |9 B$ E8 H% `+ N* I
cprintf("*"); . T1 C0 e0 l2 y' o5 U. n
if(i&gt;20) $ Q3 E2 ^6 ^7 p4 ?: |
break; ( c6 L" d* T$ C( Z
}
9 i1 h  X5 R' m# s% ~* Baa=0;
+ V  t$ k$ z) X1 t8 yif(strcmp(aa,bb)==0) ' N$ J7 n, z7 C3 l7 T+ P
{
- P2 r2 b' W2 [) x1 Ygotoxy(25,13);
9 |, P9 t+ h- ]cprintf("Your password input right!!!");
% l4 ], _8 C, x9 }, ggotoxy(25,14);
- J1 v; b4 u7 V4 zprintf("the window will close,thank you");
& n9 y; F; B  L$ [delay(10000000); - j1 Y( l: q3 x  a5 f4 P
getch(); /*正确输入后,将退出其不意*/
& r: t4 f5 R" g* |exit(0);
0 l8 k. \( Z$ V) T  v& Zclose();
, ?3 g/ f1 E" W} 9 ^2 P" O' R# W5 ?, }) h
else
, q8 `+ F6 l: ^7 F{ i=0; ) m, ]. h$ J% [9 K% o" \* U7 G8 C
count++; 1 n$ @3 c; m, E6 J, v
gotoxy(25,13);
4 j: q1 i- |3 K. i1 N, x1 zcprintf("Your password input error!!!");
) p  C" |: H3 C& T' l: Ogetch();# r1 a6 j1 t" ~
{ , L- x/ l' R7 B; S- _: f; e
gotoxy(25,14); * z. _  ?( J8 r" C- w' `
if(count&gt;3)
$ R7 Z! C' ^' M{
6 _( X- V" B2 f& F8 Hcprintf("You put the wrong number too many times");</P>6 F0 i# d8 S, E
<>gotoxy(25,15); / K. y; \/ j/ P" F
cprintf("so the computer must SHOUT DOWN!");
+ a" _, {0 o9 w( k+ c/ p5 h) n, y% tgetch();3 S: G9 [9 b$ i
exit(0);6 G+ I/ c9 g* R6 ?! A# d$ [
close();+ c, n/ `! G5 E/ L9 [9 A- I
}
! s/ N) t, P" {8 q* Tdelay(10000000000); + }# c; O- H4 ~
clrscr();
) K6 \2 T+ y' Egoto Loop; 5 ?1 m+ G, m# g8 ~; v% J' b4 C
}
4 E; I. |# `+ P- J2 f/ t$ q, Z4 X} 5 h- V& _0 J; w- B) `" E, R& W/ q
getch() ;- k/ U9 g4 Y9 Z8 G( A$ Q6 ]
}</P>
7 `' Z1 m1 Y# k. i<>              </P>) A1 l8 b& }8 L( b% V$ n
<>        来源---网上</P>
7 t0 m% _  P2 R9 H$ f7 h<>                                          </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)
: C6 x4 N& \: F9 v  {
$ i: Q& [9 y6 K   if(c==8){i--;gotoxy(46+i,12);cprintf(" ");gotoxy(46+i,12);}) R) h- C1 F# E
   else{
4 _8 i1 e% N& O4 g" Q   aa[i++]=c;
. p6 u* u& N8 m' f$ P( Q   gotoxy(45+i,12);) e9 f5 B7 _2 D& o% q9 P, V
   cprintf("*");6 v8 m; _% n; m
   if(i&gt;20) break;}' M; ^8 |6 w2 z& ~! A" g8 p3 N/ z, A
  }</P>
回复

使用道具 举报

solucky        

17

主题

1

听众

109

积分

升级  4.5%

该用户从未签到

回复

使用道具 举报

0

主题

0

听众

19

积分

升级  14.74%

该用户从未签到

新人进步奖

<>我试过怎么不行???/.cpp
, [) O; @- M  z" YC:\Documents and Settings\Administrator\1.cpp(7) : error C2065: 'clrscr' : undeclared identifier$ w; W# Y2 ?$ u! ~- k" h; N
C:\Documents and Settings\Administrator\1.cpp(8) : error C2065: 'textbackground' : undeclared identifier% F1 t& J- w1 D& ^, q" O5 z
C:\Documents and Settings\Administrator\1.cpp(9) : error C2065: 'textcolor' : undeclared identifier/ V3 o7 [1 k& n5 |& [7 V
C:\Documents and Settings\Administrator\1.cpp(11) : error C2065: 'gotoxy' : undeclared identifier
/ D- J# k' i+ D1 P/ b& C9 RC:\Documents and Settings\Administrator\1.cpp(12) : error C2065: 'cprintf' : undeclared identifier
1 Y2 l% h5 {: a& {- O& l, iC:\Documents and Settings\Administrator\1.cpp(13) : error C2065: 'getch' : undeclared identifier; P7 A4 o( H& Q6 N$ v& v9 Q7 w: C
C:\Documents and Settings\Administrator\1.cpp(18) : error C2065: 'gt' : undeclared identifier
6 G- z/ t  ?# Y: x/ HC:\Documents and Settings\Administrator\1.cpp(18) : error C2143: syntax error : missing ')' before ';') ]2 @8 N, p- i3 ^
C:\Documents and Settings\Administrator\1.cpp(18) : warning C4390: ';' : empty controlled statement found; is this the intent?1 G! ~4 I% n1 V+ Q/ B6 T* @
C:\Documents and Settings\Administrator\1.cpp(18) : error C2059: syntax error : ')'1 [! l, d; ]5 z6 l4 A- K- c
C:\Documents and Settings\Administrator\1.cpp(19) : error C2143: syntax error : missing ';' before 'break'2 {9 r/ K/ G4 B' Q' H7 H
C:\Documents and Settings\Administrator\1.cpp(22) : error C2065: 'strcmp' : undeclared identifier; @. e! d. u2 i, M
C:\Documents and Settings\Administrator\1.cpp(28) : error C2065: 'delay' : undeclared identifier
+ G; Q, c$ r6 n# kC:\Documents and Settings\Administrator\1.cpp(31) : error C2065: 'close' : undeclared identifier
6 _+ z# T! X* |- A! e# E* |% |. d% XC:\Documents and Settings\Administrator\1.cpp(41) : error C2143: syntax error : missing ')' before ';'
8 O" F( ]6 s  Q: O& _. `* XC:\Documents and Settings\Administrator\1.cpp(41) : warning C4390: ';' : empty controlled statement found; is this the intent?% N% x/ A+ D6 J1 h
C:\Documents and Settings\Administrator\1.cpp(41) : error C2059: syntax error : ')'
' \! H  F/ ^9 |C:\Documents and Settings\Administrator\1.cpp(42) : error C2143: syntax error : missing ';' before '{'
8 q- r- e3 i4 G1 {- H" hC:\Documents and Settings\Administrator\1.cpp(43) : error C2143: syntax error : missing ';' before '&lt;'
; n7 ~8 F, u+ J4 ?C:\Documents and Settings\Administrator\1.cpp(56) : warning C4508: 'main' : function should return a value; 'void' return type assumed9 A; x4 {% g+ y1 V; f9 a
C:\Documents and Settings\Administrator\1.cpp(56) : error C2143: syntax error : missing ';' before '&lt;'
* @6 I7 w* T$ b5 lC:\Documents and Settings\Administrator\1.cpp(58) : error C2018: unknown character '0xc0'2 k) ~, k4 {7 t- J( d
C:\Documents and Settings\Administrator\1.cpp(58) : error C2018: unknown character '0xb4'
: u) p8 A! O4 H! E1 d4 u* L2 yC:\Documents and Settings\Administrator\1.cpp(58) : error C2018: unknown character '0xd4'
8 N- S, W/ T1 U$ Y9 YC:\Documents and Settings\Administrator\1.cpp(58) : error C2018: unknown character '0xb4'* R7 ]: Y0 h% C5 B
C:\Documents and Settings\Administrator\1.cpp(58) : error C2018: unknown character '0xcd'
" w& L. ]1 I5 W* C2 w( SC:\Documents and Settings\Administrator\1.cpp(58) : error C2018: unknown character '0xf8'
+ u! m8 d% a# p  ^9 ]* Y/ [6 yC:\Documents and Settings\Administrator\1.cpp(58) : error C2018: unknown character '0xc9'
" B3 L2 P" ?; VC:\Documents and Settings\Administrator\1.cpp(58) : error C2018: unknown character '0xcf'
$ _5 e. F+ Q) J4 Z1 K: lError executing cl.exe.</P><>1.exe - 26 error(s), 3 warning(s)
3 T( ^# ]& m1 T7 N; M6 Z$ R</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-6-13 07:01 , Processed in 0.473581 second(s), 82 queries .

    回顶部