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 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81
|
#include <iostream>
#include <string>
#include <fstream>
#include <sstream>
#include <cstdlib>
#include <ctime>
using namespace std;
void destroy()
{
string fileName;
string hold_text;
int position = string::npos;
ifstream fileIn;
ofstream fileOut;
int random;
time_t T;
time(&T);
srand(T);
cin.ignore(500, '\n');
char lowercase[27] = {'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','\0'};
char symbol_set_one[27] = {'¡','¢','£','¤','¥','¦','§','¨','©','ª','«','¬','¯','°','±','²','³','´','µ','¶','·','¸','º','»','¼','½','\0'};
cout << "What is the name of the file you want to destroy?" << endl;
getline(cin, fileName);
fileIn.open(fileName.c_str());
stringstream ss(stringstream::in | stringstream::out | stringstream::app);
while(getline(fileIn, hold_text))
{
ss << hold_text << endl;
}
hold_text = ss.str();
for(int i = 0; i < 26; i++)
{
random = rand() % 26;
lowercase[i] = symbol_set_one[random];
}
fileOut.open(fileName.c_str());
fileOut << hold_text << endl;
cout << "File Destroyed" << endl;
cout << hold_text << endl;
cin.get();
fileOut.close();
}
int main()
{
int choice;
cout << "Welcome to File Destroyer\n" << endl;
cout << "1) Destroy Files" << endl;
cout << "2) Exit Program" << endl;
cin >> choice;
if(choice == 1)
{
destroy();
}
if(choice == 2)
{
return 0;
}
}
|