请假程序代码的填写取决于您使用的编程语言和框架。以下是几种不同编程语言的请假程序代码示例:
1. 使用Python和PySimpleGUI库
```python
import PySimpleGUI as sg
from datetime import datetime
定义窗口布局
layout = [
[sg.Text('姓名:')],
[sg.Input(key='name')],
[sg.Text('请假开始日期:')],
[sg.Input(key='start_date')],
[sg.Text('请假结束日期:')],
[sg.Input(key='end_date')],
[sg.Text('请假事由:')],
[sg.Input(key='reason')],
[sg.Button('提交')]
]
创建窗口
window = sg.Window('请假申请', layout)
事件循环
while True:
event, values = window.read()
if event == sg.WINDOW_CLOSED:
break
elif event == '提交':
name = values['name']
start_date = values['start_date']
end_date = values['end_date']
reason = values['reason']
将日期字符串转换为日期对象
start_date = datetime.strptime(start_date, '%Y-%m-%d').date()
end_date = datetime.strptime(end_date, '%Y-%m-%d').date()
计算请假天数
s_date = str((end_date - start_date)).split()
输出请假条
print(f"因{reason}需要请假,请假时间从{start_date}到{end_date},一共{s_date}天,恳请领导批准。")
关闭窗口
window.close()
```
2. 使用C语言
```c
include include include int main() { char name, reason; int start_date, end_date; printf("请输入姓名: "); scanf("%s", name); printf("请输入请假开始日期 (YYYY-MM-DD): "); scanf("%d", &start_date); printf("请输入请假结束日期 (YYYY-MM-DD): "); scanf("%d", &end_date); printf("请输入请假事由: "); scanf("%s", reason); // 在这里可以添加代码将请假信息写入文件或数据库 printf("请假申请已提交。\n"); return 0; } ``` 3. 使用JavaScript ```html 请假申请