Facebook
From Chartreuse Pheasant, 3 Years ago, written in Plain Text.
Embed
Download Paste or View Raw
Hits: 73
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.         int sum=0,Rows =3;
  8.         int rotor[10][Rows];
  9.         int keyword[Rows];
  10.         string code ="7436";
  11.        
  12.         int stepsize =2;
  13.         keyword[0] =4;
  14.         keyword[1] =5;
  15.         keyword[2] =6;
  16.         //keyword[3] =9;
  17.         //keyword[4] =9;
  18.        
  19.        
  20.         for (int x =0 ;x<10;x++)
  21.         {
  22.                 for (int y= 0; y<Rows; y++)
  23.                 {
  24.                         rotor[x][y] = 0;
  25.                         //cout<<rotor[x][y];
  26.                 }
  27.                 //cout<<endl;
  28.         }
  29.         //cout<<endl;
  30.        
  31.        
  32.         string Last;
  33.        
  34.        
  35.         for (int i =0 ;i<code.length() ;i++)
  36.         {
  37.                 if (i+1<2)
  38.                 {
  39.                         sum=0;
  40.                        
  41.                         for ( int x =0 ; x<Rows ; x++)
  42.                         {
  43.                                 Last =" ";
  44.                                 sum = sum + keyword[x] ;
  45.                
  46.                                 cout<<sum<<" sum of the keyword"<<endl;
  47.                                 Last = to_string(sum);
  48.                
  49.                                 rotor[0][x] = Last[Last.length()-1]-'0';
  50.                                 //cout<<rotor[0][x];
  51.                         }
  52.                         cout<<endl;
  53.        
  54.        
  55.                         int y =0;
  56.        
  57.        
  58.                         for (int r= 0 ;r<Rows ;r++)
  59.                         {
  60.                                 y=0;
  61.                                 for ( int val =rotor[0][r] +1; val<10;val++)
  62.                                 {
  63.                                         y++;;
  64.                                         rotor[y][r] = val;
  65.                                                
  66.                                 }
  67.                                 for (int val = 0 ; val<rotor[0][r] ;val++)
  68.                                 {
  69.                                         y++;
  70.                                         rotor[y][r] = val;
  71.                
  72.                                 }
  73.                
  74.                         }
  75.                         cout<<endl;
  76.                        
  77.                         for (int x =0;x<10 ;x++)
  78.                         {
  79.                                 for (int y =0 ; y <Rows ;y++)
  80.                                 {                      
  81.                                         cout<<rotor[x][y];
  82.                                 }
  83.                                 cout<<endl;
  84.                         }
  85.                        
  86.                         keyword[0] = keyword[0] + stepsize;
  87.                        
  88.                         cout<<keyword[0]<<" keyword of new iteration under 2"<<endl;
  89.                 }
  90.                 else
  91.                 {
  92.                         sum=0;
  93.                        
  94.                         for ( int x =0 ; x<Rows ; x++)
  95.                         {
  96.                                 Last =" ";
  97.                                 sum = sum + keyword[x] ;
  98.                
  99.                                 cout<<sum<<" sum of the keyword"<<endl;
  100.                                 Last = to_string(sum);
  101.                
  102.                                 rotor[0][x] = Last[Last.length()-1]-'0';
  103.                                 //cout<<rotor[0][x];
  104.                         }
  105.                         cout<<endl;
  106.        
  107.        
  108.                         int y =0;
  109.        
  110.        
  111.                         for (int r= 0 ;r<Rows ;r++)
  112.                         {
  113.                                 y=0;
  114.                                 for ( int val =rotor[0][r] +1; val<10;val++)
  115.                                 {
  116.                                         y++;;
  117.                                         rotor[y][r] = val;
  118.                                                
  119.                                 }
  120.                                 for (int val = 0 ; val<rotor[0][r] ;val++)
  121.                                 {
  122.                                         y++;
  123.                                         rotor[y][r] = val;
  124.                
  125.                                 }
  126.                
  127.                         }
  128.                         cout<<endl;
  129.                        
  130.                         for (int x =0;x<10 ;x++)
  131.                         {
  132.                                 for (int y =0 ; y <Rows ;y++)
  133.                                 {                      
  134.                                         cout<<rotor[x][y];
  135.                                 }
  136.                                 cout<<endl;
  137.                         }
  138.                         keyword[0] = keyword[0] + stepsize;
  139.                         keyword[1] = rotor[0][1] ;
  140.                         keyword[2] = rotor[0][2] ;
  141.                        
  142.                        
  143.                         cout<<keyword[0]<<" keyword of new iteration above 2"<<endl;
  144.                        
  145.                         cout<<keyword[1]<<" keyword of new iteration above 2"<<endl;
  146.                        
  147.                         cout<<keyword[2]<<" keyword of new iteration above 2"<<endl;
  148.                 }
  149.        
  150.                
  151.                
  152.         }
  153.         return 0;
  154.        
  155. }