-
Notifications
You must be signed in to change notification settings - Fork 0
/
ResultClass.cpp
30 lines (24 loc) · 891 Bytes
/
ResultClass.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#include <vector>
using namespace std;
struct Result {
Result() {}
int output1[1000];
};
Result altTab(int input1, int input2, int input3[]) {
// Initialize a vector to represent the current ALT-TAB window
vector<int> altTabWindow(input3, input3 + input1);
// Perform ALT-TAB operation input2 times
for (int i = 0; i < input2; i++) {
// The most recently used application will be the last one in the current window
int mostRecentlyUsed = altTabWindow.back();
altTabWindow.pop_back();
// Add it back to the front of the window to make it the most recent
altTabWindow.insert(altTabWindow.begin(), mostRecentlyUsed);
}
// Convert the final vector to an array for the result
Result result;
for (int i = 0; i < input1; i++) {
result.output1[i] = altTabWindow[i];
}
return result;
}