<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Lettergram</title>
	<atom:link href="http://lettergram.org/feed/" rel="self" type="application/rss+xml" />
	<link>http://lettergram.org</link>
	<description>Imagining is the hard part.</description>
	<lastBuildDate>Tue, 02 Oct 2012 23:33:59 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
		<item>
		<title>hamming code</title>
		<link>http://lettergram.org/hamming-code/</link>
		<comments>http://lettergram.org/hamming-code/#comments</comments>
		<pubDate>Tue, 02 Oct 2012 22:10:03 +0000</pubDate>
		<dc:creator>Lettergram</dc:creator>
				<category><![CDATA[Code]]></category>

		<guid isPermaLink="false">http://lettergram.org/?p=461</guid>
		<description><![CDATA[If you wish to download: Hamming Code.exe Hamming Code.c &#8211; Windows Version]]></description>
				<content:encoded><![CDATA[<p>If you wish to download:</p>
<p><a href='http://lettergram.org/wp-content/uploads/2012/10/Hamming-Code.exe'>Hamming Code.exe</a><br />
<a href='http://lettergram.org/wp-content/uploads/2012/10/Hamming-Code.c'>Hamming Code.c &#8211; Windows Version</a></p>
<pre class="brush: cpp; title: ; notranslate">

 
#include &lt;stdio.h&gt;
#include &lt;string.h&gt;
#include &lt;math.h&gt;
#include &lt;stdlib.h&gt;
#define SIZE 700

//This is the word encoder
void wordEncoder(int uncoded[][8],int ROWS,int COLS){
     
     int i, j, k, s, t;
     int J[8][8];
     int I[8][8];
     int c[SIZE][COLS];
     int W[SIZE][2*COLS];
     i = 0;
     j = 1;
     k = 1;
     s = 5;
     J[0][0] = 0;
    
//This generates a J matrix 
       while( i &lt; COLS ){
        k = 1;
         if(i &lt; 4){
           while( j &lt; COLS ){
             J[i][j] = k;
               if(s == j){
                  k = 0;
               }else if(s &gt; j){
                  k = 1;
               }
             j++;
           }
           j = 0; 
          s--;
         }else{
           J[i][6] = 1;
           while(j &lt; 6){
            J[i][j] = k;
               if(s &lt; j){
                  k = 1;
               }else if(s &gt; j){
                  k = 0;
               }
             j++;
           }
           j = 0;
          s++;
         }
         i++;
        } 
       i = j = 0;
       k = 0;
//End of generation of J matrix
//This generates an I matrix       
       while(i &lt; COLS){
         while(j &lt; COLS){
          if(j != k){
            I[i][j] = 0;
          }else{
            I[i][j] = 1;
          }
          j++;
         }
        k++;       
        j = 0;
        i++;
       }
//End of generation of I matrix     
     
    printf(&quot;\nThe generated A matrix [I|J] is : \n\n&quot;); 
     for ( i=0; i &lt; COLS; i++){
       printf(&quot;[&quot;);
        for (j=0; j &lt; COLS; j++){
          printf(&quot;%d&quot;, J[i][j]);
        }
        printf(&quot; &quot;);
        for (j=0; j &lt; COLS; j++){
          printf(&quot;%d&quot;, I[i][j]);
        }
       printf(&quot;]\n&quot;);
      }
  
//The encoding process AC = w
  printf(&quot;\n\nThe encoded text (A*C[i]) is: &quot;);
   k = i = j = s = t = 0;
  while(i &lt; ROWS){
    t++;
    printf(&quot;\n\nInitial value for C[%d]: &quot;, t);
    
       while(k &lt; COLS){
          printf(&quot;%d&quot;, uncoded[i][k]);
         k++;
       }
    printf(&quot;\nThe new number is w[%d]: &quot;, t);
//multiplies each row of uncoded (C), by each column of A
    while(s &lt; 14){         
      if(s &lt; 7){
           while(j &lt; COLS){
             W[i][s] += (uncoded[i][j] * I[j][s]);
             j++;
           }  
      }else{
           while(j &lt; COLS){
             W[i][s] += (uncoded[i][j] * J[j][s-7]);
             j++;
           }
      }
       W[i][s] = (W[i][s] % 2);
       printf(&quot;%d&quot;, W[i][s]);
       s++;
       j = 0;
    }
    
   k = 0;
   s = 0;
   i++;
  } 
//End of encoding  
return;
}

//This is the word decoder
void decoder(){ 
  int i, j, k, s, t;
  int COLS = 7;
  int ROWS;
  int J[8][8];
  int I[8][8];
  int c[SIZE][2*COLS];
  int W[SIZE][2*COLS];
  i = 0;
  j = 0;
  k = 1;
  s = 5;
  t = 0;
  int ch;
  char ascii;
  
  printf(&quot;\n\n&quot;);
  printf(&quot;Please type 1 if you would like to use the generated J, or 2 to type your own:\n&quot;);
  scanf(&quot;%d&quot;, &amp;k);
    if(k == 1){
//This generates the J matrix from above
       while( i &lt; COLS ){
        k = 1;
         if(i &lt; 4){
           while( j &lt; COLS ){
             J[i][j] = k;
               if(s == j){
                  k = 0;
               }else if(s &gt; j){
                  k = 1;
               }
             j++;
           }
           j = 0; 
          s--;
         }else{
           J[i][6] = 1;
           while(j &lt; 6){
            J[i][j] = k;
               if(s &lt; j){
                  k = 1;
               }else if(s &gt; j){
                  k = 0;
               }
             j++;
           }
           j = 0;
          s++;
         }
         i++;
       } 
//This is the end of the generation of the J matrix
    }else if(k == 2){ 
     printf(&quot;\nPlease enter your J matrix (must be a 7x7 matrix)\n&quot;); 
     while(i &lt; 7){
       printf(&quot;\nJ[%d]: &quot;, i);
         while((ch = getchar()) != '\n'){
             if(49 == ch){
                ch = 1;
             }else if(48 == ch){
                ch = 0;
             }
           J[i][j] = ch;
           j++;
         }
       i++;
       j = 0;
     }
    }else{
     printf(&quot;\nUnkown option, failure!\n&quot;);
     return;
   }
//This generates and I matrix
  printf(&quot;\nGenerating your I matrix for you!\n&quot;);
   i = j = k = 0;
      while(i &lt; COLS){
        while(j &lt; COLS){
          if(j != k){
            I[i][j] = 0;
          }else{
            I[i][j] = 1;
          }
         j++;
        }
       i++;
       j = 0;
       k++;
      }
//End of I matrix generation

//Prints the A* matrix 
   printf(&quot;\nThe generated A* matrix [J/I] is : \n\n&quot;); 
     for ( i=0; i &lt; COLS; i++){
       printf(&quot;[&quot;);
        for (j=0; j &lt; COLS; j++){
          printf(&quot;%d&quot;, J[i][j]);
        }
       printf(&quot;]\n&quot;);
     }
        printf(&quot;\n&quot;);
     for ( i=0; i &lt; COLS; i++){
       printf(&quot;[&quot;);   
        for (j=0; j &lt; COLS; j++){
          printf(&quot;%d&quot;, I[i][j]);
        }
       printf(&quot;]\n&quot;);
      }
   
      
   printf(&quot;\n\nPlease enter how many characters you have in your sentance?\n&quot;);
   printf(&quot;Please include puncuation and spaces: &quot;);
   scanf(&quot;%d&quot;, &amp;ROWS);
   i = 0;
   t = 1;
   j = 0;    
   k = getchar(); //Because I used scanf I have to return processor use to getchar();
//Collects each character in binary  
    while(i &lt; ROWS){

      printf(&quot;\nPlease type value for W[%d]: &quot;, t); 
           while((ch = getchar()) != '\n'){
             if(49 == ch){
                ch = 1;
             }else if(48 == ch){
                ch = 0;
             }
             W[i][j] = ch;
            j++;
           }
         t++;
         i++;
         j = 0;
        }
//Decodes each letter          
   printf(&quot;\n\nThe Decoded Text is: &quot;);         
   k = i = j = s = t = 0;
   
   while(i &lt; ROWS){
    t++;
    k = 0;
    printf(&quot;\n\nInitial value for W[%d]: &quot;, t);
    
       while(k &lt;= 2*COLS){
          printf(&quot;%d&quot;, W[i][k]);
         k++;
       }
    printf(&quot;\nThe new number is c[%d]: &quot;, t);
    j = 0;
    while(j &lt; 7){
        printf(&quot;%d&quot;, W[i][j]);
        ++j;
    }
    /*multiplies each row of encoded (W), by each column of A*
    I am removing this because it's a computer and doesn't need error checking...
    I don't have time to make it purposly add errors.
    while(s &lt; 7){ 
        while(j &lt; 2*COLS){
          if(j &lt; 7){
           c[i][s] += (W[i][j] * J[s][j]);
           j++;
          }else{
           c[i][s] += (W[i][j] * I[s][j]);
           j++;
          }
        }
     c[i][s] = (c[i][s] % 2);
     printf(&quot;%d&quot;, c[i][s]);
     s++;
     j = 0;
    }
    */
   i++;
  }
  
  i = 0;
  ch = 0;
  
  printf(&quot;\n\nYoure sentence was: &quot;);
//Converts binary to letter!
  while(i &lt; ROWS){
    
    if(W[i][0] == 1){
       ch += 64;
    }if(W[i][1] == 1){
       ch += 32; 
    }if(W[i][2] == 1){
       ch += 16;
    }if(W[i][3] == 1){
       ch += 8;
    }if(W[i][4] == 1){
       ch += 4;
    }if(W[i][5] == 1){
       ch += 2;
    }if(W[i][6] == 1){
       ch += 1;
    }
    
    ascii = ch;

    printf(&quot;%c&quot;, ascii);
    ch = 0;
    i++;
  }
//End of conversion!  
  
return;
}
      


// This is the word collector
void wordCollector(){
     
  char word[SIZE];
  char ch;
  int i = 0;
  int str_len;
  int k,num;
  int j = 7;
  int binary[SIZE][8];
  
  k = getchar();
  printf(&quot;\n***After you type your sentence, type enter**\n&quot;);
  printf(&quot;Please type the word you wish to encode: &quot;);
  while((ch = getchar()) != '\n'){
      j = 6;
      word[i] = ch;
      
    for(k = 0; k &lt; 8; k++){
        binary[i][k] = 0;
    }
    
    for(k = 0; k &lt; 1; k++){
        num = ch;//num = *(p+i);
        printf(&quot;\n\nANSI value for '%c' is %d&quot;, ch, num);
        while(num != 0){
            binary[i][j--] = num % 2;
            num /= 2;
        }
    }
    
    printf(&quot;\nConverted to Binary: &quot;);
    for(k = 0; k &lt; 7; k++){
        printf(&quot;%d&quot;, binary[i][k]);
    }
   i++; 
  } 
  
  word[i] = '&#92;&#48;';
  i = 0;
  printf(&quot;\n\nYour sentence was: \n&quot;);
       while (word[i] != '&#92;&#48;'){
            putchar(word[i]);
            printf(&quot; [&quot;);
              for(k = 0; k &lt; 7; k++){
                  printf(&quot;%d&quot;, binary[i][k]);
              }
        printf(&quot;]\n&quot;);
       i++;       
       }
       
  wordEncoder(binary, i, 7);
  
return;
}

//This is the main function
int main(void){
 
 int option = 1;
 while(option != 51){
    printf(&quot;\n\nAre you encoding(type 1), decoding(type 2) or do you wish to exit(type 3)?: &quot;);
    option = getchar();
  if(option == 49){ 
    wordCollector();
  }else if(option == 50){
    decoder();
  }else if(option == 51){
  }else{
    printf(&quot;\nInvalid Choice, Choose Another!&quot;);
  }
 }
 printf(&quot;\n\n&quot;);    
       
 system(&quot;pause&quot;);
 return 0;
}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://lettergram.org/hamming-code/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>EEA and MEA in C</title>
		<link>http://lettergram.org/eea-and-mea-in-c/</link>
		<comments>http://lettergram.org/eea-and-mea-in-c/#comments</comments>
		<pubDate>Tue, 25 Sep 2012 21:49:01 +0000</pubDate>
		<dc:creator>Lettergram</dc:creator>
				<category><![CDATA[Code]]></category>

		<guid isPermaLink="false">http://lettergram.org/?p=453</guid>
		<description><![CDATA[The following are programs for the Extended Euclidean Algorithm and Modular Exponentiation Algorithm. EEA.c EEA.exe MEA.c MEA.exe]]></description>
				<content:encoded><![CDATA[<p>The following are programs for the Extended Euclidean Algorithm and Modular Exponentiation Algorithm.</p>
<p><a href='http://lettergram.org/wp-content/uploads/2012/09/EEA1.c'>EEA.c</a><br />
<a href='http://lettergram.org/wp-content/uploads/2012/09/EEA1.exe'>EEA.exe</a></p>
<p><a href='http://lettergram.org/wp-content/uploads/2012/09/MEA.c'>MEA.c</a><br />
<a href='http://lettergram.org/wp-content/uploads/2012/09/MEA.exe'>MEA.exe</a></p>
]]></content:encoded>
			<wfw:commentRss>http://lettergram.org/eea-and-mea-in-c/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>RSA in C</title>
		<link>http://lettergram.org/rsa-in-c/</link>
		<comments>http://lettergram.org/rsa-in-c/#comments</comments>
		<pubDate>Mon, 24 Sep 2012 15:10:14 +0000</pubDate>
		<dc:creator>Lettergram</dc:creator>
				<category><![CDATA[Code]]></category>

		<guid isPermaLink="false">http://lettergram.org/?p=437</guid>
		<description><![CDATA[RSA Program in C language! The following program can encipher and decipher via the RSA method (using a public and private key). This program is basic and only allows for 27 possible characters (sorry!), but it gives the general idea of how the RSA method of encryption works. RSA Coder.exe RSAProgram.PDF RSA Coder.c (windows) RSAcoder.c ]]></description>
				<content:encoded><![CDATA[<p>RSA Program in C language!</p>
<p>The following program can encipher and decipher via the RSA method (using a public and private key). This program is basic and only allows for 27 possible characters (sorry!), but it gives the general idea of how the RSA method of encryption works.</p>
<p><a href='http://lettergram.org/wp-content/uploads/2012/09/RSA-Coder1.exe'>RSA Coder.exe</a><br />
<a href='http://lettergram.org/wp-content/uploads/2012/09/RSAProgram.pdf'>RSAProgram.PDF</a><br />
<a href='http://lettergram.org/wp-content/uploads/2012/09/RSA-Coder.c'>RSA Coder.c (windows)</a><br />
<a href='http://lettergram.org/wp-content/uploads/2012/09/RSAcoder.c'>RSAcoder.c (linux)</a></p>
<blockquote><p>The listed goals:</p>
<p><strong>Seller does the following:</strong></p>
<ol>
<li>Pick 2 prime numbers p and q.</li>
<li>Find n = pq</li>
<li>Find b = (p – 1)(q – 1)</li>
<li>Pick an exponent E such that 0 &lt; E &lt; n and gcd(E, b) = 1. (Use the EEA.)</li>
<li>Calculate D, the smallest positive solution x to the congruence . (Use the EEA.)</li>
<li>Share n and E with buyers.</li>
</ol>
<div><strong>Buyer does the following:<strong><br />
</strong></strong></p>
<ol>
<li>Type up a plaintext message.</li>
<li>Change each letter into a 2-digit number using a table.</li>
<li>Line these numbers up to make a long string.</li>
<li>Break up the sting into groups of three numbers each a Pi.</li>
<li>Encode each of the three-digit numbers into a Ci. (Use the MEA.)</li>
<li>Send the string of Ci to the seller.</li>
</ol>
</div>
<div><strong>Seller does the following:<strong><br />
</strong></strong></p>
<ol>
<li>Change the Ci to Pi.  (Use the MEA.)</li>
<li>Line these three digit numbers into a string.</li>
<li>Break the string into groups of 2 digits.</li>
<li>Look up the letters corresponding to each 2-digit number.</li>
</ol>
</div>
<div><strong>Read the plain text.</strong></div>
<pre class="brush: cpp; title: ; notranslate">

#include
#include
#include
#define SIZE 50
#define BIG 10000

//The Menu
int Menu(){

  int choice = 0;
     printf(&quot;\n\n____________________________________________________________________&quot;);
     printf(&quot;\n\nPlease type:\n\n&quot;);
     printf(&quot;  1. For seller looking to create a public and secret key.\n&quot;);
     printf(&quot;  2. For buyer looking to cipher their data.\n&quot;);
     printf(&quot;  3. For seller looking to decipher an encoded message.\n&quot;);
     printf(&quot;  4. To Exit\n&quot;);
     printf(&quot;\nChoice: &quot;);
     scanf(&quot;%d&quot;, &amp;choice);

     if(choice == 1){
        printf(&quot;\nHello Seller!\n&quot;);
        printf(&quot;\nType 1 to create a key, type 3 if you already have one: &quot;);
        scanf(&quot;%d&quot;, &amp;choice);
     }
  return choice;
}

// To find GCD
int GCD(int num1, int num2)
{
    int temp;
    while(num2!=0)
    {
        temp = num2;
        num2 = num1 % num2;
        num1 = temp;
    }
    return num1;
}

// The Extended Euclidean Algorithim
int EEA(int *m, int *n){

int i = 1;
int L[5][500];
int D;

L[0][0] = -1; // i
L[1][1] =  0; // Q
L[2][0] = *m; // ri
L[2][1] = *n; // ri
L[3][0] =  1; // x
L[3][1] =  0; // x
L[4][0] =  0; // y
L[4][1] =  1; // y

    while(L[2][i] &gt; 0){
        ++i;
        L[0][i-2] = L[0][i-2] + 1;

         L[2][i] = L[2][i-2] % L[2][i-1];
         L[1][i] = L[2][i-2] / (L[2][i-1] - L[1][i]);

        L[3][i] = L[3][i-2] - (L[1][i] * L[3][i-1]);
        L[4][i] = L[4][i-2] - (L[1][i] * L[4][i-1]);
    }
      if(L[3][i-1] &gt; 0){
         D = L[3][i-1];
      }else if(L[3][i-1] &lt; 0){
         D = (L[3][i-1] + *n);
      }

 return D;
}

// The Modular Exponentiation Algorithm
int MEA(int p, int e, int n){

int r2 = 1;
int r1 = 0;
int Q = 0;
int R = 0;

  while( e != 0 ){
     R = (e % 2);
     Q = ((e - R) / 2);

     r1 = ((p * p) % n);

       if(R == 1){
          r2 = ((r2 * p) % n);
       }
     p = r1;
     e = Q;
  }
return r2;
}

//word collector
void wordCollector(){

  char word[SIZE];
  char ch;
  int i = 0;

  ch = getchar();
  printf(&quot;\n*After you type your word type enter\n&quot;);
  printf(&quot;Please type the word you wish to encode: &quot;);
  while((ch = getchar()) != '\n'){
      word[i++] = ch;
  }
  word[i] = '&#92;&#48;';
  i = 0;
       while (word[i] != '&#92;&#48;'){
            putchar(word[i++]);
       }
  printf(&quot;\n\n&quot;);

  wordEncoder(word, i);

return;
}

//word Encoder
wordEncoder(char word[], int j){
 int i = 0;
 int k = -2;
 int t = 0;
 int P, n, E;
 int cipher[j];
 int plain[(j*2) + 2];
 int triple[(j*2) + 2];

     printf(&quot;\nIn oder to encipher the word we require an n and E.&quot;);
     printf(&quot;\nPlease enter the sellers n value: &quot;);
     scanf(&quot;%d&quot;, &amp;n);
     printf(&quot;\nPlease enter the sellers E value: &quot;);
     scanf(&quot;%d&quot;, &amp;E);
       i = 0;
         while( i &lt; j ){
         k += 2;
           switch( word[i] ){
               case ' ':
                    P = 0;
                    plain[k] = 0;
                    plain[k + 1] = 0;
                   break;
               case 'A':
               case 'a':
                    P = 1;
                    plain[k] = 0;
                    plain[k + 1] = 1;
                  break;
               case 'B':
               case 'b':
                    P = 02;
                    plain[k] = 0;
                    plain[k + 1] = 2;
                  break;
               case 'C':
               case 'c':
                    P = 03;
                    plain[k] = 0;
                    plain[k + 1] = 3;
                  break;
               case 'D':
               case 'd':
                    P = 04;
                    plain[k] = 0;
                    plain[k + 1] = 4;
                  break;
               case 'E':
               case 'e':
                    P = 05;
                    plain[k] = 0;
                    plain[k + 1] = 5;
                  break;
               case 'F':
               case 'f':
                    P = 06;
                    plain[k] = 0;
                    plain[k + 1] = 6;
                  break;
               case 'G':
               case 'g':
                    P = 07;
                    plain[k] = 0;
                    plain[k + 1] = 7;
                  break;
               case 'H':
               case 'h':
                    P = 8;
                    plain[k] = 0;
                    plain[k + 1] = 8;
                  break;
               case 'I':
               case 'i':
                    P = 9;
                    plain[k] = 0;
                    plain[k + 1] = 9;
                  break;
               case 'J':
               case 'j':
                    P = 10;
                    plain[k] = 1;
                    plain[k + 1] = 0;
                  break;
               case 'K':
               case 'k':
                    P = 11;
                    plain[k] = 1;
                    plain[k + 1] = 1;
                  break;
               case 'L':
               case 'l':
                    P = 12;
                    plain[k] = 1;
                    plain[k + 1] = 2;
                   break;
               case 'M':
               case 'm':
                    P = 13;
                    plain[k] = 1;
                    plain[k + 1] = 3;
                   break;
               case 'N':
               case 'n':
                    P = 14;
                    plain[k] = 1;
                    plain[k + 1] = 4;
                   break;
               case 'O':
               case 'o':
                    P = 15;
                    plain[k] = 1;
                    plain[k + 1] = 5;
                   break;
               case 'P':
               case 'p':
                    P = 16;
                    plain[k] = 1;
                    plain[k + 1] = 6;
                   break;
               case 'Q':
               case 'q':
                    P = 17;
                    plain[k] = 1;
                    plain[k + 1] = 7;
                   break;
               case 'R':
               case 'r':
                    P = 18;
                    plain[k] = 1;
                    plain[k + 1] = 8;
                   break;
               case 'S':
               case 's':
                    P = 19;
                    plain[k] = 1;
                    plain[k + 1] = 9;
                   break;
               case 'T':
               case 't':
                    P = 20;
                    plain[k] = 2;
                    plain[k + 1] = 0;
                   break;
               case 'U':
               case 'u':
                    P = 21;
                    plain[k] = 2;
                    plain[k + 1] = 1;
                   break;
               case 'V':
               case 'v':
                    P = 22;
                    plain[k] = 2;
                    plain[k + 1] = 2;
                   break;
               case 'W':
               case 'w':
                    P = 23;
                    plain[k] = 2;
                    plain[k + 1] = 3;
                   break;
               case 'X':
               case 'x':
                    P = 24;
                    plain[k] = 2;
                    plain[k + 1] = 4;
                   break;
               case 'Y':
               case 'y':
                    P = 25;
                    plain[k] = 2;
                    plain[k + 1] = 5;
                   break;
               case 'Z':
               case 'z':
                    P = 26;
                    plain[k] = 2;
                    plain[k + 1] = 6;
                   break;
           }
          i += 1;
          printf(&quot;\nP%-2d is:%3d&quot;, i, P);
         }
         k += 2;
 // This part ensures that there are groups of 3
     if(k % 3 == 2){
          plain[k] = 0;
     }else if(k % 3 == 1){
          plain[k] = 0;
          plain[k + 1] = 0;
     }
       k = 0;
  // Prints the data in groups of three.
     printf(&quot;\n\nYour string of numbers are: &quot;);
     while (k &lt; (2*j) ){
        printf(&quot;%d%d%d &quot;, plain[k], plain[k+1], plain[k+2]);
        k += 3;
     }
     printf(&quot;\n&quot;);
     k = 0;
     i = 1;
 //This part ensures that the loop for ciphering stops appropriately.
        t = (j / 3);
 //ciphers the groups of three.
     while (i &lt; j + 1 - t){       
       printf(&quot;\nYour ciphered text C%-2d is: &quot;, i);
       triple[i - 1] = (plain[k]*100) + (plain[k + 1] * 10) + (plain[k + 2]);         
         k += 3;       
         P = triple[i - 1];       
         cipher[i - 1] = MEA(P, E, n);         
         printf(&quot;%3d&quot;, cipher[i - 1]);         
        i++;       
     }       
  printf(&quot;\n\n&quot;);   
return;  
}  

//Decipher  
void Decipher(){     
int i, k, D, n, t;     
int j = 1;              
  
      printf(&quot;\nHow many ciphered number packets do you have? &quot;);          
      scanf(&quot;%d&quot;, &amp;i);           

int cipher[i];     
int triple[i];     
int plain[i * 3];               

      printf(&quot;\nPlease enter the D value: &quot;);         
      scanf(&quot;%d&quot;, &amp;D);               
      printf(&quot;\nPlease enter the n value: &quot;);          
      scanf(&quot;%d&quot;, &amp;n);          
      printf(&quot;\n&quot;);                
       while(i &gt; j - 1){
          printf(&quot;Please enter the C%d digit: &quot;, j);
          scanf(&quot;%d&quot;, &amp;cipher[j - 1]);
          triple[j - 1] = MEA( cipher[j - 1], D, n );
          j++;
       }

     j = 1;
     printf(&quot;\nYour string is: &quot;);

       while(i &gt; j - 1){
          printf(&quot;%d &quot;, triple[j - 1]);
          j++;
       }
       printf(&quot;\n\n&quot;);

   j = 0;
   k = 0;
   t = 1;
   int s = 0;
   int q = 0;
   int plain2[i*2];

     while(i &gt; j){

         while((3 * i) &gt; k){
              plain[k + 2] = triple[j] % 10;
              triple[j]    = triple[j] / 10;
              plain[k + 1] = triple[j] % 10;
              triple[j]    = triple[j] / 10;
              plain[k]     = triple[j] % 10;
              triple[j]    = triple[j] / 10;
         j++;
            if(s == 0){

              printf(&quot;\nP%d is %d%d&quot;, t, plain[k], plain[k + 1]);
              plain2[q] = (plain[k]*10) + plain[k + 1];
              t++;

              printf(&quot;\nP%d is %d&quot;, t, plain[k + 2]);
              plain2[q + 1] = plain[k+2] * 10;
              t++;
              s = 1;

            }else if(s == 1){

              printf(&quot;%d&quot;, plain[k]);
              plain2[q + 1] += plain[k];

              printf(&quot;\nP%d is %d%d&quot;, t, plain[k + 1], plain[k + 2]);
              plain2[q + 2] = (plain[k + 1] * 10) + plain[k + 2];
              t++;
              s = 0;
              q += 3;
            }

         k += 3;
        }
     }
   j = 0;
   char word[i];
   char c = ' ';
    printf(&quot;\n&quot;);
     while( q &gt; j){
           switch( plain2[j] ){
               case 0:
                    word[j] = ' ';
                   break;
               case 1:
                    if(j &lt; 1){
                       word[j] = 'A';
                    }else{
                       word[j] = 'a';
                    }
                  break;
               case 2:
                    if(j &lt; 1){
                       word[j] = 'B';
                    }else{
                       word[j] = 'b';
                    }
                  break;
               case 3:
                    if(j &lt; 1){
                       word[j] = 'C';
                    }else{
                       word[j] = 'c';
                    }
                  break;
               case 4:
                    if(j &lt; 1){
                       word[j] = 'D';
                    }else{
                       word[j] = 'd';
                    }
                  break;
               case 5:
                    if(j &lt; 1){
                       word[j] = 'E';
                    }else{
                       word[j] = 'e';
                    }
                  break;
               case 6:
                    if(j &lt; 1){
                       word[j] = 'F';
                    }else{
                       word[j] = 'f';
                    }
                  break;
               case 7:
                    if(j &lt; 1){
                       word[j] = 'G';
                    }else{
                       word[j] = 'g';
                    }
                  break;
               case 8:
                    if(j &lt; 1){
                       word[j] = 'H';
                    }else{
                       word[j] = 'h';
                    }
                  break;
               case 9:
                    if(j &lt; 1){
                       word[j] = 'I';
                    }else{
                       word[j] = 'i';
                    }
                  break;
               case 10:

                    if(j &lt; 1){
                       word[j] = 'J';
                    }else{
                       word[j] = 'j';
                    }
                  break;
               case 11:
                    if(j &lt; 1){
                       word[j] = 'K';
                    }else{
                       word[j] = 'k';
                    }
                  break;
               case 12:
                    if(j &lt; 1){
                       word[j] = 'L';
                    }else{
                       word[j] = 'l';
                    }
                   break;
               case 13:
                    if(j &lt; 1){
                       word[j] = 'M';
                    }else{
                       word[j] = 'm';
                    }
                   break;
               case 14:
                    if(j &lt; 1){
                       word[j] = 'N';
                    }else{
                       word[j] = 'n';
                    }
                   break;
               case 15:
                    if(j &lt; 1){
                       word[j] = 'O';
                    }else{
                       word[j] = 'o';
                    }
                   break;
               case 16:
                    if(j &lt; 1){
                       word[j] = 'P';
                    }else{
                       word[j] = 'p';
                    }
                   break;
               case 17:
                    if(j &lt; 1){
                       word[j] = 'Q';
                    }else{
                       word[j] = 'q';
                    }
                   break;
               case 18:
                    if(j &lt; 1){
                       word[j] = 'R';
                    }else{
                       word[j] = 'r';
                    }
                   break;
               case 19:
                    if(j &lt; 1){
                       word[j] = 'S';
                    }else{
                       word[j] = 's';
                    }
                   break;
               case 20:
                    if(j &lt; 1){
                       word[j] = 'T';
                    }else{
                       word[j] = 't';
                    }
                   break;
               case 21:
                    if(j &lt; 1){
                       word[j] = 'U';
                    }else{
                       word[j] = 'u';
                    }
                   break;
               case 22:
                    if(j &lt; 1){
                       word[j] = 'V';
                    }else{
                       word[j] = 'v';
                    }
                   break;
               case 23:
                    if(j &lt; 1){
                       word[j] = 'W';
                    }else{
                       word[j] = 'w';
                    }
                   break;
               case 24:
                    if(j &lt; 1){
                       word[j] = 'X';
                    }else{
                       word[j] = 'x';
                    }
                   break;
               case 25:
                    if(j &lt; 1){
                       word[j] = 'Y';
                    }else{
                       word[j] = 'y';
                    }
                   break;
               case 26:
                    if(j &lt; 1){                                                
                       word[j] = 'Z';                                          
                    }else{                                                
                       word[j] = 'z';
                    }                                        
                   break;                         
            }                  
        j++;             
       }                
  j = 0;   
                
     printf(&quot;\n\nYour deciphered word is: &quot;); 
        
   while(q &gt; j){
         printf(&quot;%c&quot;, word[j]);
         j++;
   }
    printf(&quot;\n\n&quot;);

  return;
}

int main(void){

int prime1;
int prime2;
int choice, n, b, D, j, E;

 printf(&quot;\nWelcome to the RSA Enciphering - Deciphering Program!&quot;);

   choice = Menu();
 while(choice != 4){
  if(choice == 1){
       printf(&quot;\nPlease enter prime number 1: &quot;);
       scanf(&quot;%d&quot;, &amp;prime1);
       printf(&quot;\nPlease enter prime number 2: &quot;);
       scanf(&quot;%d&quot;, &amp;prime2);
       n = prime1 * prime2;
       printf(&quot;\nn is equal to %d\n&quot;, n);
       b = (prime1 - 1)*(prime2 - 1);
       printf(&quot;\nb is equal to %d\n&quot;, b);
       printf(&quot;\nPlease pick an E: &quot;);
       scanf(&quot;%d&quot;, &amp;E);
       j = GCD(E, b);
     while(j != 1){
            printf(&quot;\nSorry that E is incompatible!\n&quot;);
            printf(&quot;\nPlease pick an E: &quot;);
            scanf(&quot;%d&quot;, &amp;E);
            j = GCD(E, b);
     }

      D = EEA(&amp;E, &amp;b);
      printf(&quot;\nD is equal to %d\n\n&quot;, D);

      printf(&quot;If you would like to give a someone (or group)\n&quot;);
      printf(&quot; the public key please do so now.\n\n&quot;);

  }else if(choice == 2){
    wordCollector();
  }else if(choice == 3){
     Decipher(&amp;n);
  }else{
    printf(&quot;\n\nSorry, perhaps next time you'll hit a real option!\n\n&quot;);
  }
  choice = Menu();
 }

system(&quot;pause&quot;);
return 0;
}
</pre>
</blockquote>
]]></content:encoded>
			<wfw:commentRss>http://lettergram.org/rsa-in-c/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>C++  &#8211; Alphabetizer</title>
		<link>http://lettergram.org/program-1-c/</link>
		<comments>http://lettergram.org/program-1-c/#comments</comments>
		<pubDate>Sat, 23 Jun 2012 19:15:13 +0000</pubDate>
		<dc:creator>Lettergram</dc:creator>
				<category><![CDATA[Code]]></category>

		<guid isPermaLink="false">http://lettergram.org/?p=422</guid>
		<description><![CDATA[Programming assignment found online. Write a program that stores lists of names (the last name first) and ages in parallel arrays and sorts the names into alphabetical order keeping the ages with the correct names. The original arrays of names and ages should remain no changes. Therefore, you need to create an array of character ]]></description>
				<content:encoded><![CDATA[<p>Programming assignment found online.</p>
<blockquote><p>Write a program that stores lists of names (the last name first) and ages in parallel arrays and sorts the names into alphabetical order keeping the ages with the correct names. The original arrays of names and ages should remain no changes. Therefore, you need to create an array of character pointers to store the addresses of the names in the name array initially. Apply the selection sort to this array of pointers so that the corresponding names are in alphabetical order.
</p></blockquote>
<p>Compiled Program: <a href='http://lettergram.org/wp-content/uploads/2012/06/Student-Alphabetizer.exe'>Student Alphabetizer</a></p>
<p>Header5.h</p>
<p><span id="more-422"></span></p>
<pre class="brush: cpp; title: ; notranslate">
// Student.h //
#include &lt;iostream&gt;
#include &lt;iomanip&gt;

using namespace std;

class Student{
      public:
         void Engine();
         int NumberPeople();
         void DisplayOriginal(char **, int *, int);
         void DisplayAlpha(char**, int *, int);
         
      private:
        int NUMBER;
        int age[50];
        char name[50][30];
        int i;
};
</pre>
<p>member.cpp:</p>
<pre class="brush: cpp; title: ; notranslate">

//member//

#include &lt;iostream&gt;
#include &lt;iomanip&gt;
#include &lt;cstring&gt;
#include &quot;Student.h&quot;

using namespace std;

void Student::Engine(){
 char name[50][30];
 int age[50]; 
 int i = 0;
 char * alphaptr[50];
 char * nameptr[50];
 int ageptr[50];
 int NUMBER = NumberPeople();
     cin.ignore();
    
    while(i &lt; NUMBER){
         cout &lt;&lt; &quot;\nEnter name &quot; &lt;&lt; i+1 &lt;&lt; &quot; (lastname, firstname): &quot;;
         cin.getline(name[i], 30, '\n');
         cout &lt;&lt; &quot;Enter age &quot; &lt;&lt; i+1 &lt;&lt; &quot;: &quot;;
         cin &gt;&gt; age[i];
         cin.ignore(); 
            alphaptr[i] = name[i];
            nameptr[i] = name[i];
            ageptr[i] = age[i];
         ++i;
      }
    DisplayOriginal(&amp;nameptr[0], age, NUMBER);
    DisplayAlpha(&amp;alphaptr[0], ageptr, NUMBER);
    DisplayOriginal(&amp;nameptr[0], age, NUMBER); 
}


int Student::NumberPeople(){
  int NUMBER;
       cout &lt;&lt; &quot;Enter number of people (0...50)\n&gt; &quot;;
       cin &gt;&gt; NUMBER;
  return NUMBER;
}

void Student::DisplayOriginal(char (**const nameptr), int age[], int NUMBER){
     
  i = 0;
      cout &lt;&lt; &quot;\nOriginal list&quot; &lt;&lt; endl;
      cout&lt;&lt;setfill('-')&lt;&lt;setw(20)&lt;&lt;&quot;-&quot;&lt;&lt;endl;
  	while(i &lt; NUMBER){
        
		cout &lt;&lt; setfill('&#92;&#48;') &lt;&lt; setw(30) &lt;&lt; left &lt;&lt; nameptr[i] &lt;&lt; right &lt;&lt; age[i] &lt;&lt; endl;
		++i;
	}
}


void Student::DisplayAlpha(char (**const alphaptr), int ageptr[], int NUMBER){
     
  char *tempname;
  int numtemp;
  int j;
  int u;
  for(u = 0; u &lt; NUMBER - 1; ++u){            
     for(i = 0; i &lt; NUMBER - 1; ++i){            
      j = strcmp(alphaptr[i], alphaptr[i + 1]);
         if(j &gt; 0){
			tempname = alphaptr[i];
			alphaptr[i] = alphaptr[i + 1];
			alphaptr[i + 1] = tempname;
			numtemp = ageptr[i];
			ageptr[i] = ageptr[i + 1];
			ageptr[i + 1] = numtemp;
          }
      }
   }		
	i = 0;
      cout &lt;&lt; &quot;\nAlphabetized list&quot; &lt;&lt; endl;
	  cout&lt;&lt;setfill('-')&lt;&lt;setw(20)&lt;&lt;&quot;-&quot;&lt;&lt;endl;
	while(i &lt; NUMBER){
		cout &lt;&lt; setfill('&#92;&#48;') &lt;&lt; setw(30) &lt;&lt; left &lt;&lt; alphaptr[i] &lt;&lt; right &lt;&lt; ageptr[i] &lt;&lt; endl;
		++i;
	}     
}
</pre>
<p>main:</p>
<pre class="brush: cpp; title: ; notranslate">
// main //

#include &lt;iostream&gt; 
#include &quot;Student.h&quot;
using namespace std;

int main(){
 
 Student myStudent;
 
 myStudent.Engine();
     cout &lt;&lt; &quot;\n\n\n&quot;;
   
 system(&quot;pause&quot;);
 return 0;
}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://lettergram.org/program-1-c/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Operation TRAMP</title>
		<link>http://lettergram.org/operation-tramp/</link>
		<comments>http://lettergram.org/operation-tramp/#comments</comments>
		<pubDate>Thu, 07 Jun 2012 03:33:48 +0000</pubDate>
		<dc:creator>Lettergram</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://lettergram.org/?p=418</guid>
		<description><![CDATA[TRAMP: T &#8211; Transportable R &#8211; Remote A &#8211; Access M &#8211; Monetarily P &#8211; Practical The Big Idea After spending most of my time on a computer I have grown to despise it. Not so much at home, but working in an office setting it is just awful! I am currently working at a ]]></description>
				<content:encoded><![CDATA[<h2>TRAMP:</h2>
<h3><span style="color: #33cccc;">T &#8211; Transportable</span></h3>
<h3><span style="color: #33cccc;">R &#8211; Remote</span></h3>
<h3><span style="color: #33cccc;">A &#8211; Access</span></h3>
<h3><span style="color: #33cccc;">M &#8211; Monetarily</span></h3>
<h3><span style="color: #33cccc;">P &#8211; Practical</span></h3>
<h1><span style="color: #9b2645;">The Big Idea</span></h1>
<p><span id="more-418"></span></p>
<p>After spending most of my time on a computer I have grown to despise it. Not so much at home, but working in an office setting it is just awful! I am currently working at a help desk for a growing corporation and are biggest issue is simple, we cannot obtain proper software, equipment, or even enough time to keep up with the growing demands of the company. I spent 9 hours today simply installing new operating systems on towers, nine stress filled, soul draining, watching loading-bar hours. What I want, what I NEED is a more efficient way of handling this. Over the last couple of weeks I have read about many solutions to this problem and here is what I have decided:</p>
<ol>
<li>You need an extremely fast internal network, gigabytes of data available for transfer at the speed of light is the only way to go.</li>
<li>A virtually unlimited source of memory.</li>
<li>An operating system (unlike Windows) that can integrate with all Java applications natively or as quickly as possible.</li>
<li>All systems must be on the same OS with it being able to suit any needs.</li>
<li>Security needs to be unbeatable.</li>
<li>I have some people in my company who did not know we could move windows around in Windows 7&#8230; I might add this is the head of my branch, we currently have over a hundred employees there and make many millions of dollars.</li>
<li>Failures are not an option.</li>
<li>I want it to be as if it is one computer, but able to fit unique user needs.</li>
</ol>
<p>THERE are the 8-keys to making the best operating system out there. The one that would be cheaper than buying every tower and safer than running a server.</p>
<p>The way I see it as most practical to achieve is by building computer units using the cheapest means available to produce, perhaps even develop cheaper computers than they have now. Connected to a state of the art (or at least exceedingly large and high processing) server capable of huge amounts of number crunching and space for storing data. The computers (which I will now refer to as units) will act as a gateway to this monster machine, allowing the users to do all the number crunching and computational heavy problems on the monster machine and the unit will only need to have the power to view the data. Essentially, these units would only need memory (perhaps rather small if the OS is done correctly) and a processor. Individual hard drives would be unneeded and because the OS would or could be stored on a much faster machine and simply moved into memory (or it could be stored there)  it would boot quicker, work quicker, and have less parts to need replacing in the field (meaning less down time).</p>
<p>The GUI the users would experience would then simply be what ever the user sees when they log onto the network. At my company it is an internal website which gives us access to the required data and input new data where need be. This allows for one centralized system, which can be personalized based on the users preferences upon login and because it is centralized all users would have access to all of the possible features allowed in the operating system. NO MORE LOADING BARS! On top of which security would be made easier by having a single server to monitor (even if this server is impossibly large, a good program can monitor it) and for remote access a separate server could be made which has higher security features or a partitioned portion of the first or security could be built in with a higher level of protection.</p>
<p>This is my ideal, right now I do not have the knowledge or experience to complete such a project and I must admit I was heavily influenced by Amazon and Google&#8217;s concepts in this area. However, I believe my idea has some features which are separate from either idea in its entirety (relating to the idea of onsite computing). Feel free to ask questions, provide insight, or sign up!</p>
]]></content:encoded>
			<wfw:commentRss>http://lettergram.org/operation-tramp/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Class Average Organizer</title>
		<link>http://lettergram.org/class-average-organizer/</link>
		<comments>http://lettergram.org/class-average-organizer/#comments</comments>
		<pubDate>Mon, 21 May 2012 01:22:01 +0000</pubDate>
		<dc:creator>Lettergram</dc:creator>
				<category><![CDATA[Code]]></category>

		<guid isPermaLink="false">http://lettergram.org/?p=415</guid>
		<description><![CDATA[The goal of this program was to allow for a number of students (max 50), to have their class averages calculated when there are only three tests]]></description>
				<content:encoded><![CDATA[<p>The goal of this program was to allow for a number of students (max 50), to have their class averages calculated when there are only three tests.</p>
<pre class="brush: cpp; title: ; notranslate">
#include &lt;stdio.h&gt;
#include &lt;string.h&gt;
#define SIZE 50

typedef struct{
    char first[SIZE];
    char last[SIZE];
    int E1;
    int E2;
    int E3;
    double avg;
} student_t;

/* Gathers data */
void Collect(int *i, student_t student[]){
 
   while(scanf(&quot;%s%s&quot;, &amp;student[*i].first, &amp;student[*i].last) != EOF){
     printf(&quot;Enter student's three exams: &quot;);
     scanf(&quot;%d&quot;, &amp;student[*i].E1);
     scanf(&quot;%d&quot;, &amp;student[*i].E2);
     scanf(&quot;%d&quot;, &amp;student[*i].E3);
     ++*i;
     printf(&quot;\nEnter student name (Ctrl-Z to stop): &quot;);
   }
        
return;
} 

/* Function Calculates and Displays Data */
void CalcDisplay(int *i, student_t student[]){

int j = 0;
double ClassAvg = 0;
char str[SIZE];

  while(j &lt; *i){
      student[j].avg = (double)((student[j].E1 + student[j].E2 + student[j].E3) / 3);  
      ClassAvg = ClassAvg + student[j].avg;
    ++j;
  }
   
   ClassAvg /= (double)(j);
   j = 0;
   
      printf(&quot;\n\nName                       Exam 1    Exam 2    Exam 3     Average&quot;);
  while(j &lt; *i){             
      sprintf(str, &quot;\n%s %s&quot;, student[j].first, student[j].last); 
      printf(&quot;%-20.20s%14d%10d%10d%12.1f\n&quot;, str, student[j].E1, student[j].E2, student[j].E3, student[j].avg);
    ++j;
  }
    printf(&quot;\n\nThe class average is %3.1f\n&quot;, ClassAvg);
      
return;
}

/* Main */
int main(void){
    
student_t student[SIZE];
int i = 0;

  printf(&quot;\nEnter student name (Ctrl-Z to stop): &quot;); 
     
     Collect(&amp;i, student);
     CalcDisplay(&amp;i, student);
    
system(&quot;pause&quot;);
return 0;
}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://lettergram.org/class-average-organizer/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Why?</title>
		<link>http://lettergram.org/why/</link>
		<comments>http://lettergram.org/why/#comments</comments>
		<pubDate>Sun, 06 May 2012 01:21:55 +0000</pubDate>
		<dc:creator>Lettergram</dc:creator>
				<category><![CDATA[Social Science]]></category>

		<guid isPermaLink="false">http://lettergram.org/?p=409</guid>
		<description><![CDATA[This poor soul just doesn&#8217;t understand]]></description>
				<content:encoded><![CDATA[<p>This poor soul just doesn&#8217;t understand.</p>
<p><span id="more-409"></span></p>
<p><a href="http://lettergram.org/wp-content/uploads/2012/05/465562_3893086011535_1410571568_3519320_622708295_o.jpg"><img class="alignleft  wp-image-410" title="Man Baby In His Natural Habitat" src="http://lettergram.org/wp-content/uploads/2012/05/465562_3893086011535_1410571568_3519320_622708295_o-1024x768.jpg" alt="" width="491" height="369" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://lettergram.org/why/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Recursion Practice</title>
		<link>http://lettergram.org/397/</link>
		<comments>http://lettergram.org/397/#comments</comments>
		<pubDate>Fri, 20 Apr 2012 05:08:55 +0000</pubDate>
		<dc:creator>Lettergram</dc:creator>
				<category><![CDATA[Code]]></category>

		<guid isPermaLink="false">http://lettergram.org/?p=397</guid>
		<description><![CDATA[Write a recursive function named two_ele_subs with one character string argument. The function will print all of the two-element subsets of a given set of letters. Write a main function with a loop to test the two_ele_subs function with different input character strings. To leave the loop press &#8216;^&#8217; and &#8216;z&#8217; key while holding down ]]></description>
				<content:encoded><![CDATA[<p>Write a recursive function named two_ele_subs with one character string argument. The function will print all of the two-element subsets of a given set of letters. Write a main function with a loop to test the two_ele_subs function with different input character strings.</p>
<p>To leave the loop press &#8216;^&#8217; and &#8216;z&#8217; key while holding down the control key:</p>
<blockquote><p>&#8216;control&#8217; + &#8216;^&#8217; then &#8216;control&#8217; + &#8216;z&#8217;</p></blockquote>
<p><strong> Iterative Version:</strong></p>
<pre class="brush: cpp; title: ; notranslate"> 
#include &lt;stdio.h&gt;
#include &lt;string.h&gt;
 
#define max_length 50
 
void two_ele_subs(char * str){
      
 int n = strlen(str);
 int i = 0;
 int j = 1;

     while(i &lt; n){
         while(j &lt; n){
            printf(&quot;[%c,%c]\n&quot;, str[i], str[j]);
              ++j;
         }
      ++i;
      j = i + 1; 
    }
 printf(&quot;\n\nEnter your string: &quot;);
}

int main(void){
    
    char str[max_length];
    
      printf(&quot;Enter your string: &quot;);
    while(scanf(&quot;%s&quot;, &amp;str) != EOF){
      two_ele_subs(str);
    }
    
system(&quot;pause&quot;);
return 0;
}
</pre>
<p><strong>Recursive Version:</strong></p>
<pre class="brush: cpp; title: ; notranslate">
 #include &lt;stdio.h&gt;
 #include &lt;string.h&gt;
 
 #define max_length 50
 
 void two_ele_subs(char * str){
      
 int n = strlen(str);
 int i = 0;
 int j = 1;
     if(n &gt; 1){
         while(j &lt; n){
             printf(&quot;[%c,%c]\n&quot;, str[i], str[j]);
             ++j;          
         }if(i &lt; n){
            ++i;
         }
      two_ele_subs(str+1);
     }                      
}

int main(void){
    
char str[max_length];
    
    printf(&quot;Enter your string: &quot;);
  while(scanf(&quot;%s&quot;, &amp;str) != EOF){
     two_ele_subs(str);
     printf(&quot;\n\nEnter your string: &quot;);
 }
     
system(&quot;pause&quot;);
return 0;
}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://lettergram.org/397/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Bearded Dragon</title>
		<link>http://lettergram.org/bearded-dragon/</link>
		<comments>http://lettergram.org/bearded-dragon/#comments</comments>
		<pubDate>Sun, 08 Apr 2012 14:43:34 +0000</pubDate>
		<dc:creator>Lettergram</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://lettergram.org/?p=387</guid>
		<description><![CDATA[]]></description>
				<content:encoded><![CDATA[<p><a href="http://lettergram.org/wp-content/uploads/2012/04/413460_3123781179395_1410571568_3201326_971943693_o.jpg"><img class="alignleft  wp-image-393" title="Bearded Dragon Car Insurance" src="http://lettergram.org/wp-content/uploads/2012/04/413460_3123781179395_1410571568_3201326_971943693_o-1024x768.jpg" alt="" width="491" height="369" /></a></p>
<p><a href="http://lettergram.org/wp-content/uploads/2012/04/Picture-46.jpg"><img class="alignleft  wp-image-389" title="Picture 46" src="http://lettergram.org/wp-content/uploads/2012/04/Picture-46-1024x768.jpg" alt="" width="491" height="369" /></a></p>
<p><a href="http://lettergram.org/wp-content/uploads/2012/04/Picture-49.jpg"><img class="alignleft  wp-image-390" title="Picture 49" src="http://lettergram.org/wp-content/uploads/2012/04/Picture-49-1024x768.jpg" alt="" width="491" height="369" /></a></p>
<p><a href="http://lettergram.org/wp-content/uploads/2012/04/459462_3710143278081_1410571568_3440931_1362102901_o.jpg"><img class="alignleft size-medium wp-image-388" title="Beardy cage" src="http://lettergram.org/wp-content/uploads/2012/04/459462_3710143278081_1410571568_3440931_1362102901_o-300x225.jpg" alt="" width="300" height="225" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://lettergram.org/bearded-dragon/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Array Practice</title>
		<link>http://lettergram.org/array-practice/</link>
		<comments>http://lettergram.org/array-practice/#comments</comments>
		<pubDate>Fri, 06 Apr 2012 02:38:28 +0000</pubDate>
		<dc:creator>Lettergram</dc:creator>
				<category><![CDATA[Code]]></category>

		<guid isPermaLink="false">http://lettergram.org/?p=380</guid>
		<description><![CDATA[Problem Description: Each year the Department of Traffic Accidents receives accident count reports from a number of cities and towns across the country. To summarize these reports, the department provides a frequency distribution printout that gives the number of cities reporting accident counts in the following ranges: 0 – 99 100 – 199 200 – ]]></description>
				<content:encoded><![CDATA[<h2><span style="text-decoration: underline;">Problem Description:</span></h2>
<p>Each year the Department of Traffic Accidents receives accident count reports from a number of cities and towns across the country. To summarize these reports, the department provides a frequency distribution printout that gives the number of cities reporting accident counts in the following ranges:</p>
<p>0 – 99<br />
100 – 199<br />
200 – 299<br />
300 – 399<br />
400 – 499<br />
500 or above</p>
<p>The department needs a computer program to take the number of accidents for each reporting city or town and add one to the count for the appropriate accident range. After all the data have been processed, the resulting frequency counts are to be displayed.</p>
<p><a href="http://lettergram.org/wp-content/uploads/2012/04/Traffic-Accident-Addition.exe">Traffic Accident Addition</a> (.exe)</p>
<pre class="brush: cpp; title: ; notranslate">
 
#include &lt;stdio.h&gt;

#define size 6

void updateRange (int *i, int *a_range){
     *i = 0;  
   while(*i &gt;= 0){
        printf(&quot;Enter an accident count (negative to end): &quot;);
        scanf(&quot;%d&quot;, &amp;*i);
                if (*i &lt;= 0){
                }else if (*i &lt;= 99){
                   a_range[0]++;
                }else if (*i &lt;= 199){
                   a_range[1]++;
                }else if (*i &lt;= 299){
                   a_range[2]++;
                }else if (*i &lt;= 399){
                   a_range[3]++;
                }else if (*i &lt;= 499){
                   a_range[4]++;
                }else if (*i &gt;= 500){
                   a_range[5]++; 
                } 
         }              
}
    
void displayRange (int *a_range){
  int y = 0;
  int numRange1 = 0;
  int numRange2 = 99;
    printf(&quot;\n   Range  Frequency\n\n&quot; ); 
    printf(&quot;%4d-%3d%10d\n &quot;,numRange1, numRange2, a_range[y]);
    ++y;
        while(y &lt; 5){         
          numRange1 += 100;
          numRange2 += 100;
            printf(&quot;%d-%d%10d\n &quot;, numRange1, numRange2, a_range[y]);
            ++y;
        }
    numRange1 += 100;
    printf(&quot;%d or above%5d\n\n&quot;,numRange1, a_range[y]);
}
       
int main(void){
  int i = 0;
  int a_range[size];
      while (i &lt; size){
          a_range[i] = 0;
        ++i;
      }    
  updateRange(&amp;i, &amp;*a_range);           
  displayRange(&amp;*a_range);
system(&quot;pause&quot;);
return 0;
}

</pre>
]]></content:encoded>
			<wfw:commentRss>http://lettergram.org/array-practice/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
