1.转码:

#include #include #include

using namespace std;

int main() { // 璁剧疆鏈湴鍖栦互鏀寔瀹藉瓧绗﹁緭鍏? setlocale(LC_ALL, ""); wstring input;

// 璇诲彇鐢ㄦ埛杈撳叆鐨勬枃鏈?
wcout << L"璇疯緭鍏ユ枃鏈? ";
getline(wcin, input);

vector<int> keyCodes;

// 閬嶅巻姣忎釜瀛楃骞惰浆鎹负铏氭嫙閿爜
for (wchar_t c : input) {
    SHORT result = VkKeyScanW(c);
    if (result == -1) {
        wcerr << L"鏃犳硶杞崲瀛楃: " << c << endl;
        continue;
    }
    BYTE vkCode = LOBYTE(result);
    keyCodes.push_back(static_cast<int>(vkCode));
}

// 杈撳嚭鍗佽繘鍒堕敭鐮侊紝绌烘牸鍒嗛殧
for (size_t i = 0; i < keyCodes.size(); ++i) {
    if (i > 0) cout << " ";
    cout << keyCodes[i];
}
cout<<endl<<keyCodes.size();
cout << endl;

return 0;

}

2.轰炸

#include #include #include

using namespace std;

int main() { // 璁剧疆鏈湴鍖栦互鏀寔瀹藉瓧绗﹁緭鍏? setlocale(LC_ALL, ""); wstring input;

// 璇诲彇鐢ㄦ埛杈撳叆鐨勬枃鏈?
wcout << L"璇疯緭鍏ユ枃鏈? ";
getline(wcin, input);

vector<int> keyCodes;

// 閬嶅巻姣忎釜瀛楃骞惰浆鎹负铏氭嫙閿爜
for (wchar_t c : input) {
    SHORT result = VkKeyScanW(c);
    if (result == -1) {
        wcerr << L"鏃犳硶杞崲瀛楃: " << c << endl;
        continue;
    }
    BYTE vkCode = LOBYTE(result);
    keyCodes.push_back(static_cast<int>(vkCode));
}

// 杈撳嚭鍗佽繘鍒堕敭鐮侊紝绌烘牸鍒嗛殧
for (size_t i = 0; i < keyCodes.size(); ++i) {
    if (i > 0) cout << " ";
    cout << keyCodes[i];
}
cout<<endl<<keyCodes.size();
cout << endl;

return 0;

}

#include<windows.h> #include<stdio.h> #include using namespace std; void Down(int letter){ keybd_event(letter,0,0,0); } void Up(int letter){ keybd_event(letter,0,KEYEVENTF_KEYUP,0); } void press(int letter){ Down(letter); Up(letter); } int main(){ int b; int c; int a[500]; printf("letter num:"); scanf("%u",&b); printf("truns:"); scanf("%u",&c); for(int i=0;i<b;i++){ printf("input %u (enter->13):",i); scanf("%u",&a[i]); } printf("5s"); Sleep(5000); for(int i=0;i<c;i++){ for(int j=0;j<b;j++){ press(a[j]); } printf("%d\n",i); Sleep(10); } return 0; }