刚刚自己写了一个程序,编译后就:
有没有大佬知道怎么办?
代码
#include <bits/stdc++.h>
#include <windows.h>
#include <conio.h>
#define Password "123456"
using namespace std;
int s;
char ch;
string str;
string op, _op_;
int main() {
srand(time(NULL));
cout << "请输入密码:";
while (1) {
ch = getch();
str += ch;
system("cls");
cout << "请输入密码:";
s ++;
for (int i = 1; i < s; i ++) {
cout << '*';
}
if (ch == '\b') {
str.erase(s - 2, 2);
s --;
system("cls");
cout << "请输入密码:";
for (int i = 1; i < s; i ++) {
cout << '*';
}
s --;
}
cout << ch;
if (str == Password) {
system("cls");
cout << "密码正确。";
Sleep(500);
break;
}
}
for (double i = 0; i < 100; i += (rand() % 5000 + 1) / 500.0) {
printf("%2lf%%", i);
Sleep(5);
system("cls");
}
cout << "100%";
const char* folderPath = "C:\\Users\\yp198\\Desktop\\";
system(("start explorer " + std::string(folderPath)).c_str());
}