Revisions
-
quicksnap revised this gist
May 4, 2012 . 1 changed file with 7 additions and 4 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -43,7 +43,7 @@ void obtainPass(char usrPass[]){ while (toupper(usrResp) != 'Y') { cout << "Please enter a phrase, \n(Limit letters a-z &" << " A-Z, 100 characters max): "<< endl; //User enters phrase cin.get(usrPass, pSize, '\n'); cin.ignore(100, '\n'); @@ -57,6 +57,7 @@ void obtainPass(char usrPass[]){ //Encryption of pass-phrase char passEncrypt(char usrPass[]){ char newPass[pSize]; int value; for (int i=0; i<pSize && usrPass[i] != '\0'; i++){ char letter = usrPass[i]; @@ -65,7 +66,9 @@ char passEncrypt(char usrPass[]){ if (maxVal >=0){ newPass[i] = usrPass[(maxVal-1)-i]; } cout << newPass[i]; value = i; } return value; } -
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,71 @@ //Name: Derrik Fleming //Class: CS162 //Prof: Karla Fant #include <iostream> using namespace std; //Functions void manager(); void welcome(); void obtainPass(char usrPass[]); char passEncrypt(char usrPass[]); //Constants const int pSize = 100; int main(){ manager(); return 0; } //Managing functions void manager(){ char usrPass[pSize]; welcome(); obtainPass(usrPass); passEncrypt(usrPass); } //Welcome statement to user void welcome(){ cout << "Welcome. \nThis program is designed " << "to generate a password based on a user-" << "entered phrase\n\n\n" << endl; return; } //Phrase to be read in void obtainPass(char usrPass[]){ char usrResp; while (toupper(usrResp) != 'Y') { cout << "Please enter a phrase, \n(Limit letters a-z &" << " A-Z, 100 characters max): "<< endl; //User enters phrase cin.get(usrPass, pSize, '\n'); cin.ignore(100, '\n'); cin.clear(); //Echos for verification cout << "Is this correct (Y/N)?: \n" << usrPass << endl; cin >> usrResp; } return; } //Encryption of pass-phrase char passEncrypt(char usrPass[]){ char newPass[pSize]; for (int i=0; i<pSize && usrPass[i] != '\0'; i++){ char letter = usrPass[i]; newPass[i] = letter; int maxVal = strlen(usrPass); if (maxVal >=0){ newPass[i] = usrPass[(maxVal-1)-i]; } cout << newPass[i]; return i; } }