The attachment preview is chopped off after the first 10 KB. Please download the entire file.

```
/*
//Name: ________
//Program: program18_26.cpp
//Purpose: to decrypt rot13 using frequency substitution
//Date:
//Date Modified: everyday
*/
#include<iostream>
#include<iomanip>
#include<cstdlib>
#include<ctime>
#include<string>
#include<fstream>
#include<cstring>
using namespace std;
int decrypt(int length, string word)
{
int freq[26];
int a = 0;
int b = 0;
int c = 0;
int d = 0;
int e = 0;
int f = 0;
int g = 0;
int h = 0;
int i = 0;
int j = 0;
int k = 0;
int l = 0;
int m = 0;
int n = 0;
int o = 0;
int p = 0;
int q = 0;
int r = 0;
int s = 0;
int t = 0;
int u = 0;
int v = 0;
int w = 0;
int x = 0;
int y = 0;
int z = 0;
int place_a = 0;
int place_b = 0;
int place_c = 0;
int place_d = 0;
int place_e = 0;
int place_f = 0;
int place_g = 0;
int place_h = 0;
int place_i = 0;
int place_j = 0;
int place_k = 0;
int place_l = 0;
int place_m = 0;
int place_n = 0;
int place_o = 0;
int place_p = 0;
int place_q = 0;
int place_r = 0;
int place_s = 0;
int place_t = 0;
int place_u = 0;
int place_v = 0;
int place_w = 0;
int place_x = 0;
int place_y = 0;
int place_z = 0;
char commoneng[26] = {'e', 't', 'a', 'o', 'i', 'n', 's', 'r', 'h', 'l', 'd', 'c', 'u', 'm', 'f', 'p', 'g', 'w', 'y', 'b', 'v', 'k', 'x', 'j', 'q', 'z'};
// gets the frequencies and fills each respective array with the place each letter is found
for(int it = 0; it < length; it++)
{
if(word[it] == 'a')
{
a++;
}
else if( word[it] == 'b')
{
b++;
}
else if( word[it] == 'c')
{
c++;
}
else if( word[it] == 'd')
{
d++;
}
else if( word[it] == 'e')
{
e++;
}
else if( word[it] == 'f')
{
f++;
}
else if( word[it] == 'g')
{
g++;
}
else if( word[it] == 'h')
{
h++;
}
else if( word[it] == 'i')
{
i++;
}
else if( word[it] == 'j')
{
j++;
}
else if( word[it] == 'k')
{
k++;
}
else if( word[it] == 'l')
{
l++;
}
else if( word[it] == 'm')
{
m++;
}
else if( word[it] == 'n')
{
n++;
}
else if( word[it] == 'o')
{
o++;
}
else if( word[it] == 'p')
{
p++;
}
else if( word[it] == 'q')
{
q++;
}
else if( word[it] == 'r')
{
r++;
}
else if( word[it] == 's')
{
s++;
}
else if( word[it] == 't')
{
t++;
}
else if( word[it] == 'u')
{
u++;
}
else if( word[it] == 'v')
{
v++;
}
else if( word[it] == 'w')
{
w++;
}
else if( word[it] == 'x')
{
x++;
}
else if( word[it] == 'y')
{
y++;
}
else if( word[it] == 'z')
{
z++;
}
}// end for
//makes arrays for each letter with the restrictions of the frequencies of each letter
int a_array[a];
int b_array[b];
int c_array[c];
int d_array[d];
int e_array[e];
int f_array[f];
int g_array[g];
int h_array[h];
int i_array[i];
int j_array[j];
int k_array[k];
int l_array[l];
int m_array[m];
int n_array[n];
int o_array[o];
int p_array[p];
int q_array[q];
int r_array[r];
int s_array[s];
int t_array[t];
int u_array[u];
int v_array[v];
int w_array[w];
int x_array[x];
int y_array[y];
int z_array[z];
// gets the place of the letters in the input and puts them into an array
for(int mm = 0; mm < length; mm++)
{
if(word[mm] == 'a')
{
if(place_a < length)
{
a_array[place_a] = mm;
place_a++;
}
}
else if( word[mm] == 'b')
{
if(place_b < length)
{
b_array[place_b] = mm;
place_b++;
}
}
else if( word[mm] == 'c')
{
if(place_c < length)
{
c_array[place_c] = mm;
place_c++;
}
}
else if( word[mm] == 'd')
{
if(place_d < length)
{
d_array[place_d] = mm;
place_d++;
}
}
else if( word[mm] == 'e')
{
if(place_e < length)
{
e_array[place_e] = mm;
place_e++;
}
}
else if( word[mm] == 'f')
{
if(place_f < length)
{
f_array[place_f] = mm;
place_f++;
}
}
else if( word[mm] == 'g')
{
if(place_g < length)
{
g_array[place_g] = mm;
place_g++;
}
}
else if( word[mm] == 'h')
{
if(place_h < length)
{
h_array[place_h] = mm;
place_h++;
}
}
else if( word[mm] == 'i')
{
if(place_i < length)
{
i_array[place_i] = mm;
place_i++;
}
}
else if( word[mm] == 'j')
{
if(place_j < length)
{
j_array[place_j] = mm;
place_j++;
}
}
else if( word[mm] == 'k')
{
if(place_k < length)
{
k_array[place_k] = mm;
place_k++;
}
}
else if( word[mm] == 'l')
{
if(place_l < length)
{
l_array[place_l] = mm;
place_l++;
}
}
else if( word[mm] == 'm')
{
if(place_m < length)
{
m_array[place_m] = mm;
place_m++;
}
}
else if( word[mm] == 'n')
{
if(place_n < length)
{
n_array[place_n] = mm;
place_n++;
}
}
else if( word[mm] == 'o')
{
if(place_o < length)
{
o_array[place_p] = mm;
place_o++;
}
}
else if( word[mm] == 'p')
{
if(place_p < length)
{
p_array[place_p] = mm;
place_p++;
}
}
else if( word[mm] == 'q')
{
if(place_q < length)
{
q_array[place_q] = mm;
place_q++;
}
}
else if( word[mm] == 'r')
{
if(place_r < length)
{
r_array[place_r] = mm;
place_r++;
}
}
else if( word[mm] == 's')
{
if(place_s < length)
{
s_array[place_s] = mm;
place_s++;
}
}
else if( word[mm] == 't')
{
if(place_t < length)
{
t_array[place_t] = mm;
place_t++;
}
}
else if( word[mm] == 'u')
{
if(place_u < length)
{
u_array[place_u] = mm;
place_u++;
}
}
else if( word[mm] == 'v')
{
if(place_v < length)
{
v_array[place_v] = mm;
place_v++;
}
}
else if( word[mm] == 'w')
{
if(place_w < length)
{
w_array[place_w] = mm;
place_w++;
}
}
else if( word[mm] == 'x')
{
if(place_x < length)
{
x_array[place_x] = mm;
place_x++;
}
}
else if( word[mm] == 'y')
{
if(place_y < length)
{
y_array[place_y] = mm;
place_y++;
}
}
else if( word[mm] == 'z')
{
if(place_z < length)
{
z_array[place_z] = mm;
place_z++;
}
}
}// end for
```