Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <dirent.h>
- #include <iostream>
- #include <vector>
- #include <string>
- #include <cstdlib>
- #include <ctime>
- #include <conio.h>
- using namespace std;
- int main()
- {
- srand(time(NULL));
- string path;
- struct dirent *dir;
- vector<string> dirlist;
- cout << "Nudzi Ci sie? Podaj sciezke do folderu z grami: ";
- cin >> path;
- DIR *d = opendir(path.c_str());
- while ((dir = readdir(d)) != NULL)
- {
- dirlist.push_back(dir -> d_name);
- }
- path += "\SteamLibrary\SteamApps\common";
- d = opendir(path.c_str());
- while ((dir = readdir(d)) != NULL)
- {
- dirlist.push_back(dir -> d_name);
- }
- int n;
- cout << "Ile chcialbys propozycji ziomeczku? ";
- cin >> n;
- cout << "Hmm... Proponuje zagrac w:" << endl;
- do {
- int temp = rand() % dirlist.size();
- if (dirlist[temp] == "." || dirlist[temp] == ".." || dirlist[temp] == "SteamLibrary" || dirlist[temp] == "desktop.ini") {}
- else
- {
- cout << dirlist[temp] << endl;
- n--;
- }
- } while (n != 0);
- getch();
- closedir(d);
- return(0);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement