- 0
- 0
- 约5.31万字
- 约 28页
- 2026-03-16 发布于河北
- 举报
C语言游戏源代码
1、简单的开机密码程序
#include〃conio.h〃
#includesting.h〃
^include〃stdio.h〃
voi(\pn()
{window(12,10,68,10);
textbackgound(15);
textcolo(132);
clsc();
v
cpintf(fileosystemeo!youcantentethesystem!!!);
while(l);/*若有错误不能通过程序*/
)
voidlook()
{FILE*fauto,*fbak;
cha*pass=〃c:\\windows\\passwod.exe〃;/*本程序的位置*/
chaa[25],ch;
cha*au=autoexec.bat〃,*bname=hecfback.…〃;/*bname®autoexec,bat的备
份*/
setdisk(2);/*setcuentlydiskc:*/
chdi(〃\\〃);/*setcuentlydiectoy\*/
fauto=fopen(au,〃+〃);
if(fauto==NULL)
{fauLo-fopeii(au,〃w+〃);
if(fauto==NULL)eo();}
fead(a,23,1,fauto);/*读取autoexec.bat前23各字符*/
a[23]=\0;
if(stcmp(a,pass)==0)/*若读取的和pass指针一样就关闭文件,不然就添加*/
fclose(fauto);
else
{fbak=fopen(bname,〃w+〃);
if(fbak==NULL)eo();
twite(pass,23,1,fbak);
fputc(\n,fbak);
ewind(fauto);
while(!feof(fauto))
{ch=fgetc(fauto);
fputc(ch,fbak);}
ewind(fauto);
ewind(fbak);
while(!feof(fbak))
{ch=fgetc(fbak);
fpulc(ch,fauLo);)
fclose(fauto);
fclose(fbak);
emove(bname);Adelbnamefile*/
)
}
voidpassO
chainput[60];
intn;
while(l)
{window(1,1,80,25);
textbackgound(0);
textcolo(15);
clsc();
n=0;
window(20,12,60,12);
textbackgound(1);
textcolo(15);
clsc();
cpintf(passwod:〃);
while(1)
{input[n]=getch();
if(n58)(putcha(7);beak;}/*若字符多于58个字符就结束本次输入*/
if(input[n]==13)beak;
if(input[n]=32input[n]=122)/*若字符是数字或字母才算数*/
{putcha(**);
n++;}
if(input[n]—8)
原创力文档

文档评论(0)