1.【C++模拟打卡计时系统】

#include <iostream>
#include <stdlib.h>
#include <time.h>
#include <string>
using namespace std;
clock_t start, stop;
double duration;
class Xinxi
{
public:
    char name[100];
    char number[100];
    char password[100];
    Xinxi(char na[100], char nu[100], char pa[100]) 
    {
        char name = na[100];
        char number = nu[100];
        char password = pa[100];
        
    }
    Xinxi() {}
    void shangban()
    {
        cin >> name >> number >> password; 
    }
    void xiaban()
    {
        cin >> name >> number >> password;
        cout << "打卡成功!下班!" << endl;
    }
};
int main()
{
    int i,j=1;
    Xinxi x;
    char name1[100], number1[100], password1[100], phonenumber1[100];;
    char A[100] = { "A" }, B[100] = { "B" }, C[100] = {"D"}, D[100], VC[100];
    cout << "A.注册,B.登入,C.找回密码 " << endl;
    cin >> D;
    system("cls");
    system("color 70");
    if (strcmp(D, A) == 0)
    {
        system("cls");
        system("color 70");
        cout << "********************************注册系统<<********************************" << endl;
        cout << "请输入您的手机号:" << endl;
        cout << "+86" << endl;
        cin >> phonenumber1;
        cout << "验证码为:";
        cin >> VC;
        system("cls");
        cout << "********************************注册成功 * *******************************" << endl;
        cout << "工号为:21032114" << endl;
    }
    else if (strcmp(D, B) == 0)
    {
        cout << "********************************登入系统<<********************************" << endl;
        cout << "姓名:";
        cin >> x.name;
        cout << "工号:";
        cin >> x.number;
        cout << "密码(初始密码6个0):";
        cin >> x.password;
        system("cls");
        system("color 70");
        while (j)
        {
            if (strcmp(x.password, "000000") == 0)
            {
                j = 0;
                system("cls");
                system("color 70");
                cout << "********************************账号登入成功<<********************************" << endl;
                cout << "请输入一个非0的数进行打卡上班" << endl;
                
                while (cin >> i)               //打卡指令
                {

                    if (i != 0)
                    {
                        cout << "元气满满的一天! 加油打工人,打卡成功!!!" << endl;
                        start = clock();                //开始记时-
                    }
                    else
                    {
                        cout << "今天就到此为止吧,明天依旧光芒万丈!,打卡成功!" << endl;
                        break;
                    }
                    cout << "请输入0进行下班打卡!" << endl;
                }
                stop = clock();    //结束记时
                system("cls");
                system("color 70");
                duration = ((double)(stop - start)) / CLK_TCK;                     //计算时间
                cout << "上班时长为:" << duration << "秒" << endl;                 //输出时间
            }
            else
            {
                cout << "密码错误!!!!!,请重新输入密码." << endl;
                cin >> x.password;
            }
        }
    }
    else
    {

        cout<<"您输入的指令有误:"<<endl;

    }

    return 0;
}
168d3445d1b64e51907bc980c5f9ca77.png

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

吉士先生

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值