#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; }