Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
当我不存在
抽签
提交
eb8ddc00
抽
抽签
项目概览
当我不存在
/
抽签
通知
2
Star
0
Fork
1
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
2
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
抽
抽签
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
2
合并请求
2
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
eb8ddc00
编写于
8月 14, 2023
作者:
当我不存在
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
更新main.c, 说明.txt
已删除GUI.py
上级
d9f413cc
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
52 addition
and
69 deletion
+52
-69
GUI.py
GUI.py
+0
-26
main.c
main.c
+51
-42
说明.txt
说明.txt
+1
-1
未找到文件。
GUI.py
已删除
100644 → 0
浏览文件 @
d9f413cc
import
os
import
tkinter
as
tk
#导入tkinter库
GUI
=
tk
.
Tk
()
#创建窗体,名为GUI
def
reaction
(
event
):
aaa
=
os
.
popen
(
"main.exe"
)
result
.
delete
(
'1.0'
,
'end'
)
result
.
insert
(
'end'
,
aaa
.
read
())
result
=
tk
.
Text
(
GUI
,
height
=
1
,
width
=
8
)
result
.
pack
()
whether_to_continue
=
tk
.
Button
(
GUI
,
text
=
"next"
)
whether_to_continue
.
pack
()
aaa
=
os
.
popen
(
"main.exe"
)
result
.
insert
(
'end'
,
aaa
.
read
())
while
(
True
):
whether_to_continue
.
bind
(
"<Button-1>"
,
reaction
)
GUI
.
mainloop
()
main.c
浏览文件 @
eb8ddc00
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
int
main
()
{
char
ch
;
//记行数用
int
quit
=
1
;
//输出while循环是否退出(0退出,非0继续循环)
int
mumber_number
=
0
;
//文件行数
FILE
*
fp
=
fopen
(
".
\\
NAME.name"
,
"r"
);
//二进制读打开NAME.name
if
((
fp
=
fopen
(
".
\\
NAME.name"
,
"r"
))
==
NULL
)
{
//如果文件不存在
printf
(
"Error :) There is no file named 'NAME.name'"
);
//输出错误原因
return
-
1
;
//退出程序
}
//记算行数
while
((
ch
=
fgetc
(
fp
))
!=
EOF
)
{
//文件读取完后退出循环
if
(
ch
==
'\n'
)
{
//读取到换行符时进入if
mumber_number
++
;
//行数加一
}
}
char
name
[
60
][
20
];
//用来储存名字,60个名字,每个名字不大于20位
//开始存名字
fseek
(
fp
,
0
,
0
);
//光标回到文件开头
while
((
ch
=
fgetc
(
fp
))
!=
EOF
)
{
//文件读取完毕后退出循环
int
line
=
0
;
for
(
line
=
0
;
line
<=
mumber_number
;
line
++
)
{
//line指读取到的行数
fscanf
(
fp
,
"%s"
,
&
name
[
line
][
0
]);
//存入name
}
}
fclose
(
fp
);
//关闭文件
//
int
who
=
0
;
//作为被抽者的数组下表
srand
((
unsigned
)
time
(
NULL
));
//刷新种子
who
=
rand
()
%
(
mumber_number
+
1
);
//产生1-50的随机数
printf
(
"%s"
,
name
[
who
]);
//输出结果
return
0
;
//退出,返回1
}
\ No newline at end of file
#include <windows.h>
#include <tchar.h>
#include <locale.h>
#include<time.h>
int
main
(
void
){
char
ch
;
//记行数用
int
quit
=
1
;
//输出while循环是否退出(0退出,非0继续循环)
int
mumber_number
=
0
;
//文件行数
FILE
*
fp
=
fopen
(
".
\\
NAME.name"
,
"r"
);
//二进制读打开NAME.name
if
((
fp
=
fopen
(
".
\\
NAME.name"
,
"r"
))
==
NULL
)
{
//如果文件不存在
printf
(
"Error :) There is no file named 'NAME.name'"
);
//输出错误原因
return
-
1
;
//退出程序
}
//记算行数
while
((
ch
=
fgetc
(
fp
))
!=
EOF
)
{
//文件读取完后退出循环
if
(
ch
==
'\n'
)
{
//读取到换行符时进入if
mumber_number
++
;
//行数加一
}
}
char
name
[
60
][
20
];
//用来储存名字,60个名字,每个名字不大于20位
//开始存名字
fseek
(
fp
,
0
,
0
);
//光标回到文件开头
while
((
ch
=
fgetc
(
fp
))
!=
EOF
)
{
//文件读取完毕后退出循环
int
line
=
0
;
for
(
line
=
0
;
line
<=
mumber_number
;
line
++
)
{
//line指读取到的行数
fscanf
(
fp
,
"%s"
,
&
name
[
line
][
0
]);
//存入name
}
}
fclose
(
fp
);
setlocale
(
LC_ALL
,
""
);
int
who
=
0
;
while
(
1
)
{
who
=
0
;
//作为被抽者的数组下表
srand
((
unsigned
)
time
(
NULL
));
//刷新种子
who
=
rand
()
%
(
mumber_number
+
1
);
MessageBox
(
NULL
,
name
[
who
],
"结果"
,
MB_OK
);
}
//return 0;
}
说明.txt
浏览文件 @
eb8ddc00
运行:
抽签
.exe
运行:
random_GUI
.exe
如需修改名单:
1.用notepad打开Name.name
2.修改格式:
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录