Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- #include<Windows.h>
- #include"stdafx.h"
- #include<ctime>
- using namespace std;
- int main() {
- void *backgroundChosen = NULL;
- srand((unsigned int)time(0));
- int randomNum = 1 + (rand() % 21);
- switch (randomNum)
- {
- case 1:
- backgroundChosen = "C:\\Users\\Matthew\\Desktop\\Backgrounds\\1.jpg";
- break;
- case 2:
- backgroundChosen = "C:\\Users\\Matthew\\Desktop\\Backgrounds\\2.jpg";
- break;
- case 3:
- backgroundChosen = "C:\\Users\\Matthew\\Desktop\\Backgrounds\\3.jpg";
- break;
- case 4:
- backgroundChosen = "C:\\Users\\Matthew\\Desktop\\Backgrounds\\4.jpg";
- break;
- case 5:
- backgroundChosen = "C:\\Users\\Matthew\\Desktop\\Backgrounds\\5.jpg";
- break;
- case 6:
- backgroundChosen = "C:\\Users\\Matthew\\Desktop\\Backgrounds\\6.jpg";
- break;
- case 7:
- backgroundChosen = "C:\\Users\\Matthew\\Desktop\\Backgrounds\\7.jpg";
- break;
- case 8:
- backgroundChosen = "C:\\Users\\Matthew\\Desktop\\Backgrounds\\8.jpg";
- break;
- case 9:
- backgroundChosen = "C:\\Users\\Matthew\\Desktop\\Backgrounds\\9.jpg";
- break;
- case 10:
- backgroundChosen = "C:\\Users\\Matthew\\Desktop\\Backgrounds\\10.jpg";
- break;
- case 11:
- backgroundChosen = "C:\\Users\\Matthew\\Desktop\\Backgrounds\\11.jpg";
- break;
- case 12:
- backgroundChosen = "C:\\Users\\Matthew\\Desktop\\Backgrounds\\12.jpg";
- break;
- case 13:
- backgroundChosen = "C:\\Users\\Matthew\\Desktop\\Backgrounds\\13.jpg";
- break;
- case 14:
- backgroundChosen = "C:\\Users\\Matthew\\Desktop\\Backgrounds\\14.jpg";
- break;
- case 15:
- backgroundChosen = "C:\\Users\\Matthew\\Desktop\\Backgrounds\\15.jpg";
- break;
- case 16:
- backgroundChosen = "C:\\Users\\Matthew\\Desktop\\Backgrounds\\16.jpg";
- break;
- case 17:
- backgroundChosen = "C:\\Users\\Matthew\\Desktop\\Backgrounds\\17.jpg";
- break;
- case 18:
- backgroundChosen = "C:\\Users\\Matthew\\Desktop\\Backgrounds\\18.jpg";
- break;
- case 19:
- backgroundChosen = "C:\\Users\\Matthew\\Desktop\\Backgrounds\\19.jpg";
- break;
- case 20:
- backgroundChosen = "C:\\Users\\Matthew\\Desktop\\Backgrounds\\20.jpg";
- break;
- case 21:
- backgroundChosen = "C:\\Users\\Matthew\\Desktop\\Backgrounds\\21.jpg";
- break;
- }
- // Change Desktop Background
- int return_value = SystemParametersInfo(SPI_SETDESKWALLPAPER, 0, backgroundChosen, SPIF_UPDATEINIFILE);
- }
- void backgroundGen()
- {
- int y;
- int x;
- cout << "Enter the number you want the to Start Generating At: ";
- cin >> x;
- cout << "Enter the number you want the Generator to stop Generating At: ";
- cin >> y;
- for (int x; x <= y; x++)
- {
- cout << "case " << x << ":" << endl << "backgroundChosen = \"C:\\Users\\Matthew\\Desktop\\Backgrounds\\\"" << x << ".jpg" << endl << "break;" << endl << endl;
- }
- cin.get();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement