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
|
#include <iostream>
#include <string>
#include <fstream>
using namespace std;
bool compare(&string[], &string[], &int);
int main(){
//define ALL variables
int passed, failed, sizeP, sizeC;
string *commList, *passList, passName, commName, numPass, numCheck, temp;
//prompt for names of files that will be opened
cout << "Please enter the name of the file: ";
cin >> passName;
cout << "Please enter the name of the common passwords file: ";
cin >> commName;
//open files and check if they are open
ifstream passwords;
passwords.open(passName);
if(!passwords){
cout << "Error opening file" << endl;
return 1;
}
ifstream commPass;
commPass.open(commName);
if(!commPass){
cout << "Error opening file" << endl;
return 1;
}
//get the number of passwords by seing the first value of the array
getline(passwords, numPass);
//convert it to a int
sizeP = stoi(numPass);
// make it the size of a new array
passList = new string[sizeP];
//Do the same for the other array of common passwords
getline(commPass, numCheck);
sizeC = stoi(numCheck);
commList = new string[sizeC];
cout << "Checked " << sizeP << " passwords in file: " << passName << endl;
//enter both of these text files into the arrays
for(int count = 0; count < sizeP; count++){
getline(passwords, passList[count]);
for(int increment = 0 && count < sizeP){
temp = passList[increment];
temp[increment]
}
};
for(int count = 0; count < sizeC; count++){
getline(commPass, commList[count]);
};
}
bool compare (&commList[], ¤tpass[], &sizep){
}
| |