打印本文 关闭窗口 |
|
| 游戏及学习控制管理器 | |
| 作者:佚名 文章来源:不详 点击数 更新时间:2008/4/18 13:57:17 文章录入:杜斌 责任编辑:杜斌 | |
|
|
|
|
/*控制主程序control.exe*/ char p[70];
if(n==2) { printf("\n请输入家长控制密码:"); while(p[i]=getch()) { if(p[i]==13) break; if(p[i]!='\b') { printf("*"); i++; } else { printf("\b \b"); i--; } } p[i]='\0'; if(strcmp(password,p)==0) { printf("\n密码通过!"); printf("请设定游戏时间 [单位:分钟]\n"); scanf("%d",&time); startgame(time); } else { printf("\n密码错误!按任意键退出"); getch(); exit(1); } } } /*控制关闭程序break.exe*/ DEV-CPP 32位C工程 #include<stdio.h> #include<dos.h> #include<string.h> int main(int argc,char **argv) { int t; int i; char s[100]; if(argc>2) { sscanf(argv[2],"%d",&t); sleep(t*60000); sprintf(s,"taskkill /im %s /f",argv[1]); system(s); } return 0; } /*学习控制器 study.exe 比较简陋的,有待更新*/ #include<stdio.h> #include<stdlib.h> #include<time.h> #include<dir.h> int main(void) { time_t time1,time2; int n; int x; int points; char path[100]; char password[20]; FILE *input,*output; printf("你可以通过学习英语获取游戏点数,每一分钟的学习将获得一点游戏点"); printf("\n是否学习?[1.学习 2.终止]"); scanf("%d",&n); if(n==1) { getcwd(path,100); chdir("D:\\ruanjian\\New Oriental Soft\\New Oriental Words 4\\"); /*这是一个学习软件的路径*/ time1=time(NULL); system("Recite4.exe"); /*学习软件的程序名*/ time2=time(NULL); x=(int)(difftime(time2,time1)/60); chdir(path); input=fopen("control","r"); fscanf(input,"%d%s",&points,password); points=points+x; fclose(input); output=fopen("control","w"); fprintf(output,"%d\n%s",points,password); fclose(output); } return 0; } |
|
打印本文 关闭窗口 |