Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Finished?
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256:9ab5970f93fba3bc266f0c3f9caa6d930840a7b6d07e25696d9534221bcde786
User & Date: sarah 2018-05-18 04:15:39
Context
2018-05-18
13:26
make file update check-in: 0b470197cd user: sarah tags: trunk
04:15
Finished? check-in: 9ab5970f93 user: sarah tags: trunk
03:55
Decode done? check-in: 7907a90d3e user: sarah tags: trunk
Changes

Changes to project7/project7.

cannot compute difference between binary files

Changes to project7/project7.cpp.

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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
...
100
101
102
103
104
105
106




107
108
109

110
111
112
113
114
115
116
117
118
119











120
121
122
123
124










125
126
127
128
129
130
131
132
133
134
135
136
137
138
    {
        getline(cin, UsersPhrase);
        CipherShiftKey();
        string bugfix;        // basically, without this the spcae from hitting enter on the cipher shift key would go to the next getline and would break the program.
        getline(cin, bugfix); // basically, without this the spcae from hitting enter on the cipher shift key would go to the next getline and would break the program.
        int length;
        length = UsersPhrase.length();
        char c;
char e;
        for (int i = 0; i < length; i++)
        {
            c = UsersPhrase[i];
            if (!isalpha(c))
            {
                cout << "this is not an alpha charachter" << c << "\n";
                
                e = c ;
            }
            else
            {
            cout << c;
            
            e = c + ShiftKeyNumber;

            if (e > 122)
            {
                e = e - 26;
        
            }
            if (e > 90 && e < 97)
            {
                e = e - 26;
            }
            }
             cout << "char: " << c << "shifted: " << e << "\n";
        }
       
    }
    void Decode()
    {
        getline(cin, UsersPhrase);
        CipherShiftKey();
        string bugfix; // basically, without this the spcae from hitting enter on the cipher shift key would go to the next getline and would break the program.
        getline(cin, bugfix);

        // basically, without this the spcae from hitting enter on the cipher shift key would go to the next getline and would break the program.
        int length;
        length = UsersPhrase.length();
        char c;
        char e;
        for (int i = 0; i < length; i++)
        {
            c = UsersPhrase[i];
            if (!isalpha(c))
            {
                cout << "this is not an alpha charachter" << c << "\n";
                
                e = c ;
            }
            else
            {
            cout << c;
            
            e = c - ShiftKeyNumber;

            if (e< 80)
            {
                e = e + 26;
        
            }
            if (e > 90 && e < 97)
            {
                e = e + 26;
            }
            }
             cout << "char: " << c << "shifted: " << e << "\n";
        }
    }
    void CipherShiftKey()
    {

        cout << "What cipher shift key would you like to use? (0-20)";
        cin >> ShiftKeyNumber;
................................................................................
            cin >> ShiftKeyNumber;
        }
    }
};

int main()
{




    string UsersChoice;
    cout << "Hello! ";
    CeaserCipher CeaserCipherobject;

    for (;;)
    {
        cout << "\nWould you like to encode, decode, or quit? ";
        getline(cin, UsersChoice);
        cout << UsersChoice;

        if (UsersChoice == "encode" || UsersChoice == "Encode")
        {
            cout << "\nPlease enter the words or phrases you wish to encode ";
            CeaserCipherobject.Encode();











        }
        else if (UsersChoice == "decode" || UsersChoice == "Decode")
        {
            cout << "\nPlese enter the words or phrases you wish to decode ";
            CeaserCipherobject.Decode();










        }
        else if (UsersChoice == "quit" || UsersChoice == "Quit")
        {
            exit(0);
        }
        else
        {

            cout << "Error!" << UsersChoice << "Invalid entry";
        }
    }

    return 0;
}







|
|


|
|

|

|



|

|

|

|


|

|


|













|
|


|
|

|

|



|

|

|

|


|

|


|







 







>
>
>
>



>










>
>
>
>
>
>
>
>
>
>
>





>
>
>
>
>
>
>
>
>
>








|


|


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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
...
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
    {
        getline(cin, UsersPhrase);
        CipherShiftKey();
        string bugfix;        // basically, without this the spcae from hitting enter on the cipher shift key would go to the next getline and would break the program.
        getline(cin, bugfix); // basically, without this the spcae from hitting enter on the cipher shift key would go to the next getline and would break the program.
        int length;
        length = UsersPhrase.length();
        char charachtersoftheuserphrase;
char EncodedOrDecodedCharachtersOftheUserPhrase;
        for (int i = 0; i < length; i++)
        {
            charachtersoftheuserphrase = UsersPhrase[i];
            if (!isalpha(charachtersoftheuserphrase))
            {
                cout << "this is not an alpha charachter" << charachtersoftheuserphrase << "\n";
                
                EncodedOrDecodedCharachtersOftheUserPhrase= charachtersoftheuserphrase ;
            }
            else
            {
            cout << charachtersoftheuserphrase;
            
            EncodedOrDecodedCharachtersOftheUserPhrase = charachtersoftheuserphrase+ ShiftKeyNumber;

            if (EncodedOrDecodedCharachtersOftheUserPhrase > 122)
            {
                EncodedOrDecodedCharachtersOftheUserPhrase = EncodedOrDecodedCharachtersOftheUserPhrase - 26;
        
            }
            if (EncodedOrDecodedCharachtersOftheUserPhrase > 90 && EncodedOrDecodedCharachtersOftheUserPhrase < 97)
            {
                EncodedOrDecodedCharachtersOftheUserPhrase = EncodedOrDecodedCharachtersOftheUserPhrase - 26;
            }
            }
             cout << "char: " << charachtersoftheuserphrase << "shifted: " << EncodedOrDecodedCharachtersOftheUserPhrase << "\n";
        }
       
    }
    void Decode()
    {
        getline(cin, UsersPhrase);
        CipherShiftKey();
        string bugfix; // basically, without this the spcae from hitting enter on the cipher shift key would go to the next getline and would break the program.
        getline(cin, bugfix);

        // basically, without this the spcae from hitting enter on the cipher shift key would go to the next getline and would break the program.
        int length;
        length = UsersPhrase.length();
        char charachtersoftheuserphrase;
        char EncodedOrDecodedCharachtersOftheUserPhrase;
        for (int i = 0; i < length; i++)
        {
            charachtersoftheuserphrase = UsersPhrase[i];
            if (!isalpha(charachtersoftheuserphrase))
            {
                cout << "this is not an alpha charachter" << charachtersoftheuserphrase << "\n";
                
                EncodedOrDecodedCharachtersOftheUserPhrase = charachtersoftheuserphrase ;
            }
            else
            {
            cout << charachtersoftheuserphrase;
            
            EncodedOrDecodedCharachtersOftheUserPhrase = charachtersoftheuserphrase - ShiftKeyNumber;

            if (EncodedOrDecodedCharachtersOftheUserPhrase< 80)
            {
                EncodedOrDecodedCharachtersOftheUserPhrase = EncodedOrDecodedCharachtersOftheUserPhrase + 26;
        
            }
            if (EncodedOrDecodedCharachtersOftheUserPhrase > 90 && EncodedOrDecodedCharachtersOftheUserPhrase < 97)
            {
                EncodedOrDecodedCharachtersOftheUserPhrase = EncodedOrDecodedCharachtersOftheUserPhrase + 26;
            }
            }
             cout << "char: " << charachtersoftheuserphrase << "shifted: " << EncodedOrDecodedCharachtersOftheUserPhrase << "\n";
        }
    }
    void CipherShiftKey()
    {

        cout << "What cipher shift key would you like to use? (0-20)";
        cin >> ShiftKeyNumber;
................................................................................
            cin >> ShiftKeyNumber;
        }
    }
};

int main()
{
   string YesorNo; // To find out if the user wants to play again
  YesorNo = "yes";// so the loop works
  while (YesorNo == "Yes" || YesorNo == "yes") 
    {
    string UsersChoice;
    cout << "Hello! ";
    CeaserCipher CeaserCipherobject;
    
    for (;;)
    {
        cout << "\nWould you like to encode, decode, or quit? ";
        getline(cin, UsersChoice);
        cout << UsersChoice;

        if (UsersChoice == "encode" || UsersChoice == "Encode")
        {
            cout << "\nPlease enter the words or phrases you wish to encode ";
            CeaserCipherobject.Encode();
        cout<<"Do you wish to encode/decode again?( Yes, No)";
        cin>> YesorNo;
        if(YesorNo=="Yes" || YesorNo=="yes")
        {
            system("cls");
        }
        else
        {
            exit(0);
        }

        }
        else if (UsersChoice == "decode" || UsersChoice == "Decode")
        {
            cout << "\nPlese enter the words or phrases you wish to decode ";
            CeaserCipherobject.Decode();
             cout<<"Do you wish to encode/decode again?(Yes, No)";
        cin>> YesorNo;
        if(YesorNo=="Yes" || YesorNo=="yes")
        {
            system("cls");
        }
        else
        {
            exit(0);
        }
        }
        else if (UsersChoice == "quit" || UsersChoice == "Quit")
        {
            exit(0);
        }
        else
        {

            cout << "Error!";
        }
    }
    }
    return 0;
}