[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: final project
- To: http://www.vermont.gov/~flora. (Flora E ), http://profiles.yahoo.com/Flora (Flora E ), http://www.gmail.com/~flora (Flora E )
- Subject: Re: final project
- From: Robert <http://dummy.us.eu.org/robert>
- Date: Wed, 21 Jun 2017 14:25:35 -0700
- Keywords: ifile: nonspam -2145.29432297 spam -2298.75425148 downloaded -3078.51065826 ---------
Comments below.
> From: Flora <http://www.gmail.com/~flora>
> Date: Wed, 21 Jun 2017 16:28:06 -0400
>
> #include <iostream>
> #include <fstream>
> #include <string>
>
> using namespace std;
>
>
> int option;
> string firstName;
> string lastName;
> string password;
> string encrypted;
> string username;
>
> // Function Definition: Returns the encrypted argument text string
> string encrypt(string text)
> {
> // Loop through and encrypt each character
> for (int i = 0; i < text.length(); i++)
> {
> text.at(i) = (text.at(i) + 13) % 127;
> // If non-printable (< 33), then adjust
> if (text.at(i) < 33)
> text.at(i) += 33;
You probably know this, but this excludes the space character.
> }
> return text; // Returns encrypted text
> }
>
> bool isValid (string password)
> {
> if (password.length() < 10)
> return false;
> else
> return true;
> }
>
> int main()
> {
> {
> // Precondition: None
> // Postcondition: Prints the menu to standard output
> }
> void printMenu();
> {
> cout << "\n\nPlease choose one of the following options:\n\n";
> cout << "\tEnter '1' to login to an existing account\n";
> cout << "\tEnter '2' to create a new account\n";
> cout << "\tEnter '3' to exit\n\n";
> cout << "Option: ";
> }
I think the formatting may have got screwed up for the above since it
looks like it wouldn't compile.
> do
> {
> void printMenu();
If you define printMenu() before you use it, this declaration shouldn't be
necessary.
> cin >> option;
> switch (option)
> {
> case 1:
> cout << "\nLog Into Your Account....." << endl;
> break;
>
> case 2:
> cout << "\nCreating new acccount........\n\tFirst Name:\t";
> cin >> firstName;
> cout << "\tLast Name:\t";
> cin >> lastName;
> cout << "\nCreate a password that is:\n\t-At least 10 characters long\n\t-Contains no whitespaces\nPassword: ";
> cin >> password;
I assume that you will eventually call isValid().
> cout << password;
Is it required that the password be printed out?
> encrypted = encrypt(password);
> cout << "Ciphertext: " << encrypted << endl;
> return 0;
> break;
>
> case 3: cout << "\n***Exiting Program...... Goodbye.\n";
> break;
> default: cout << "\nInvalid Option\n";
> }
> } while (option != 3);
> return 0;
> }