打卡C语言第2天,2060:【例1.1】计算机输出时间限制

2060:【例1.1】计算机输出


时间限制: 1000 ms         内存限制: 65536 KB
提交数: 162460     通过数: 81016

【题目描述】

在屏幕上输出“Hello World!”。

【输入】

(无)

【输出】

(无)

【输入样例】

(无)

【输出样例】

Hello World!

提交 统计信息 提交记录

#include <iostream>
using namespace std;
int main()
{
    cout<<"Hello World!"<<endl;
    return 0;
}

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
根据提供的引用内容,以下是一个简单的考勤打卡系统的C语言: ```c #include <stdio.h> #include <time.h> // 定义员工结构体 struct Employee { int id; char name[50]; int lateCount; int earlyCount; int absentCount; }; // 定义全局变量 struct Employee employees[10]; int employeeCount = 0; // 函数声明 void clockIn(int employeeId); void clockOut(int employeeId); void viewAttendance(); void searchAttendance(); void deleteAttendance(); void modifyAttendance(); int main() { int choice; int employeeId; char password[50]; // 主菜单 do { printf("1. 员工上班打卡\n"); printf("2. 员工下班打卡\n"); printf("3. 查看考勤情况\n"); printf("4. 查询考勤信息\n"); printf("5. 删除考勤信息\n"); printf("6. 修改考勤信息\n"); printf("7. 退出\n"); printf("请输入您的选择:"); scanf("%d", &choice); switch (choice) { case 1: printf("请输入员工ID:"); scanf("%d", &employeeId); clockIn(employeeId); break; case 2: printf("请输入员工ID:"); scanf("%d", &employeeId); clockOut(employeeId); break; case 3: viewAttendance(); break; case 4: searchAttendance(); break; case 5: deleteAttendance(); break; case 6: modifyAttendance(); break; case 7: printf("谢谢使用!\n"); break; default: printf("无效的选择,请重新输入。\n"); break; } } while (choice != 7); return 0; } // 上班打卡 void clockIn(int employeeId) { time_t now; time(&now); struct tm *local = localtime(&now); // 检查员工是否存在 int i; for (i = 0; i < employeeCount; i++) { if (employees[i].id == employeeId) { // 更新上班时间 printf("员工 %s 上班打卡成功,打卡时间:%02d:%02d:%02d\n", employees[i].name, local->tm_hour, local->tm_min, local->tm_sec); return; } } // 员工不存在 printf("员工ID %d 不存在。\n", employeeId); } // 下班打卡 void clockOut(int employeeId) { time_t now; time(&now); struct tm *local = localtime(&now); // 检查员工是否存在 int i; for (i = 0; i < employeeCount; i++) { if (employees[i].id == employeeId) { // 更新下班时间 printf("员工 %s 下班打卡成功,打卡时间:%02d:%02d:%02d\n", employees[i].name, local->tm_hour, local->tm_min, local->tm_sec); return; } } // 员工不存在 printf("员工ID %d 不存在。\n", employeeId); } // 查看考勤情况 void viewAttendance() { int i; for (i = 0; i < employeeCount; i++) { printf("员工ID:%d\n", employees[i].id); printf("员工姓名:%s\n", employees[i].name); printf("迟到次数:%d\n", employees[i].lateCount); printf("早退次数:%d\n", employees[i].earlyCount); printf("旷工数:%d\n", employees[i].absentCount); printf("\n"); } } // 查询考勤信息 void searchAttendance() { int choice; printf("1. 按员工ID查询\n"); printf("2. 按员工姓名查询\n"); printf("请输入查询方式:"); scanf("%d", &choice); switch (choice) { case 1: // 按员工ID查询 break; case 2: // 按员工姓名查询 break; default: printf("无效的选择。\n"); break; } } // 删除考勤信息 void deleteAttendance() { // 需要密码验证 char password[50]; printf("请输入密码:"); scanf("%s", password); // 删除考勤信息 } // 修改考勤信息 void modifyAttendance() { // 需要密码验证 char password[50]; printf("请输入密码:"); scanf("%s", password); // 修改考勤信息 } ```

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值