社区讨论

电脑问题求助!悬关!

灌水区参与者 7已保存回复 15

讨论操作

快速查看讨论及其快照的属性,并进行相关操作。

当前回复
15 条
当前快照
1 份
快照标识符
@lyu8yw0e
此快照首次捕获于
2024/07/20 22:51
2 年前
此快照最后确认于
2024/07/21 09:16
2 年前
查看原帖
刚刚自己写了一个程序,编译后就: 有没有大佬知道怎么办?
代码
CPP
#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());
}

回复

15 条回复,欢迎继续交流。

正在加载回复...