1. C++ / Говнокод #16863

    +53

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    class CClass
    {
    //...
       boost::shared_ptr<CTestData> mpTestData;
    //...
    };
    
    void CClass::setTestData(boost::shared_ptr<CTestData> pTestData)
    {
       if(pTestData.use_count() == 0)
       {
          mpTestData.reset();
       }
       else
       {
          mpTestData = pTestData;
       }
    }

    hedrok, 16 Октября 2014

    Комментарии (3)
  2. C++ / Говнокод #16856

    +57

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    30. 30
    31. 31
    bool operator ==( const CClass& lhs, const CClass& rhs )
    {
       bool rc = true;
    
       // No self-comparison...
       if ( &lhs != &rhs )
       {
          // Do not compare fields if result is already false...
          if ( rc )
          {
             rc = ( lhs.frameId() == rhs.frameId());
          }
          if ( rc )
          {
             rc = ( lhs.objectId() == rhs.objectId());
          }
          if ( rc )
          {
             rc = ( lhs.type() == rhs.type() );
          }
          if ( rc )
          {
             rc = ( lhs.transition() == rhs.transition() );
          }
          if ( rc )
          {
             rc = ( lhs.rotation() == rhs.rotation() );
          }
       }
       return rc;
    }

    hedrok, 15 Октября 2014

    Комментарии (25)
  3. C++ / Говнокод #16847

    +55

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    30. 30
    31. 31
    32. 32
    33. 33
    34. 34
    35. 35
    36. 36
    37. 37
    38. 38
    39. 39
    40. 40
    41. 41
    42. 42
    43. 43
    44. 44
    45. 45
    46. 46
    47. 47
    48. 48
    49. 49
    50. 50
    51. 51
    52. 52
    53. 53
    54. 54
    bool nt_utils::enum_processes(std::vector<uint32_t>& pids)
    {
      pids.clear();
    
      PDWORD process_ids = NULL;
      DWORD cb = ALLOC_SIZE;
      DWORD bytes_returned = 0;
      BOOL complete = FALSE;
    
      __try {
    
        while (!complete) {
          process_ids = static_cast<PDWORD>(
            ::HeapAlloc(
              ::GetProcessHeap(),
              HEAP_GENERATE_EXCEPTIONS | HEAP_ZERO_MEMORY,
              cb
            )
          );
    
          if (::EnumProcesses(process_ids, cb, &bytes_returned)) {
            if (cb == bytes_returned) {
              ::HeapFree(::GetProcessHeap(), 0, process_ids);
              process_ids = NULL;
              cb *= 2;
            } else {
              complete = TRUE;
            }
          } else {
            ::HeapFree(::GetProcessHeap(), 0, process_ids);
            process_ids = NULL;
            complete = TRUE;
          }
        }
        
        if (process_ids) {
          DWORD size = bytes_returned / sizeof(DWORD);
          pids.reserve(size);
          for (DWORD i = 0; i < size; ++i) {
            assert(process_ids[i]);
            pids[i] = process_ids[i];
          }
          ::HeapFree(::GetProcessHeap(), 0, process_ids);
        }
    
      } __except (EXCEPTION_EXECUTE_HANDLER) {
        if (process_ids) {
          ::HeapFree(::GetProcessHeap(), 0, process_ids);
        }
        return false;
      }
    
      return !!process_ids;
    }

    Получение id всех процессов

    gc4242, 14 Октября 2014

    Комментарии (25)
  4. C++ / Говнокод #16832

    +58

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    if(!vect.empty())
    {
       cv::sort(vect, vect, CV_SORT_ASCENDING );
    }
    
    while(vect.size()>100)
    {
       cv::sort(vect, vect, CV_SORT_DESCENDING );
       vect.pop_back();
       cv::sort(vect, vect, CV_SORT_ASCENDING );
       vect.pop_back();
    }

    hedrok, 09 Октября 2014

    Комментарии (8)
  5. C++ / Говнокод #16818

    +58

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    30. 30
    31. 31
    32. 32
    33. 33
    34. 34
    35. 35
    36. 36
    37. 37
    38. 38
    39. 39
    40. 40
    41. 41
    42. 42
    43. 43
    44. 44
    45. 45
    46. 46
    47. 47
    48. 48
    49. 49
    50. 50
    #include "internationalization.h"
    namespace internationalization
    {
     
    QString numToString(int num, CASE padezh)
    {
        switch ( padezh )
        {
        case NOMINATIVE:
            switch ( num )
            {
            case 0:     return "ноль";
            case 1:     return "один";
            case 2:     return "два";
            case 3:     return "три";
            case 4:     return "четыре";
            case 5:     return "пять";
            case 6:     return "шесть";
            case 7:     return "семь";
            case 8:     return "восемь";
            case 9:     return "девять";
            case 10:     return "десять";
            case 11:     return "одиннадцать";
            case 12:     return "двенадцать";
            case 13:     return "тринадцать";
            case 14:     return "четырнадцать";
            case 15:     return "пятнадцать";
            case 16:     return "шестнадцать";
            case 17:     return "семьнадцать";
            case 18:     return "восемьнадцать";
            case 19:     return "девятнадцать";
            case 20:     return "двадцать";
            case 21: case 22: case 23: case 24: case 25: case 26: case 27: case 28: case 29:    return numToString( num / 10 * 10 ) + " " + numToString( num % 10 );
            case 30:     return "традцать";
            case 31: case 32: case 33: case 34: case 35: case 36: case 37: case 38: case 39:    return numToString( num / 10 * 10 )  + " " +  numToString( num % 10 );
            case 40:    return "сорок";
            case 41: case 42: case 43: case 44: case 45: case 46: case 47: case 48: case 49:    return numToString( num / 10 * 10 )  + " " +  numToString( num % 10 );
            case 50:    return "пятьдесят";
            case 51: case 52: case 53: case 54: case 55: case 56: case 57: case 58: case 59:      return numToString( num / 10 * 10 )  + " " +  numToString( num % 10 );
            case 60:    return "шестьдесят";
            case 61: case 62: case 63: case 64: case 65: case 66: case 67: case 68: case 69:      return numToString( num / 10 * 10 )  + " " +  numToString( num % 10 );
            case 70:    return "семьдесят";
            case 71: case 72: case 73: case 74: case 75: case 76: case 77: case 78: case 79:      return numToString( num / 10 * 10 )  + " " +  numToString( num % 10 );
            case 80:    return "восемьдесят";
            case 81: case 82: case 83: case 84: case 85: case 86: case 87: case 88: case 89:      return numToString( num / 10 * 10 )  + " " +  numToString( num % 10 );
            case 90:    return "девяносто";
            case 91: case 92: case 93: case 94: case 95: case 96: case 97: case 98: case 99:      return numToString( num / 10 * 10 )  + " " +  numToString( num % 10 );
            case 100:   return "сто";
            case 101: case 102: case 103: case 104: case 105: case 106: case 107: case 108: case 109:   return numToString( (num / 100 % 10 ) * 100 )  + " " +  numToString( num % 10 );
            case 110: case 111: case 112: case 113: case 114: case 115: case 116: case 117: case 118: case 119: case 120: case 121: case 122: case 123: case 124: case 125: case 126: case 127: case 128: case 129: case 130: case 131: case 132: case 133: case 134: case 135: case 136: case 137: case 138: case 139: case 140: case 141: case 142: case 143: case 144: case 145: case 146: case 147: case 148: case 149: case 150: case 151: case 152: case 153: case 154: case 155: case 156: case 157: case 158: case 159: case 160: case 161: case 162: case 163: case 164: case 165: case 166: case 167: case 168: case 169: case 170: case 171: case 172: case 173: case 174: case 175: case 176: case 177: case 178: case 179: case 180: case 181: case 182: case 183: case 184: case 185: case 186: case 187: case 188: case 189: case 190: case 191: case 192: case 193: case 194: case 195: case 196: case 197: case 198: case 199:      return numToString( (num / 100 % 10 ) * 100 ) + " " +  numToString( (num / 10 % 10 ) * 10 )  + " " +  numToString( num % 10 );

    Такой код мне встретился в моем старом проекте... Мне кажется, или из меня вышел бы неплохой программист в Китае или Индии?
    И там не конец, весь файл сего перла здесь: http://pastebin.com/tpAd95fd

    Dart_Sergius, 07 Октября 2014

    Комментарии (33)
  6. C++ / Говнокод #16797

    +57

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    30. 30
    31. 31
    32. 32
    33. 33
    34. 34
    35. 35
    36. 36
    37. 37
    38. 38
    39. 39
    40. 40
    41. 41
    42. 42
    43. 43
    44. 44
    45. 45
    46. 46
    47. 47
    48. 48
    49. 49
    50. 50
    51. 51
    52. 52
    53. 53
    54. 54
    55. 55
    56. 56
    57. 57
    58. 58
    59. 59
    60. 60
    61. 61
    62. 62
    63. 63
    64. 64
    65. 65
    66. 66
    67. 67
    68. 68
    69. 69
    70. 70
    71. 71
    72. 72
    73. 73
    74. 74
    75. 75
    76. 76
    77. 77
    78. 78
    79. 79
    80. 80
    for (j=0;j<3;j++) {
    			tmp += member[i].V[2][j] * member[i].V[0][j];}
    		if (tmp > LENGTH_EPS) {
    			if ( node[member[i].n0].u_fix.y == 0 ) { //if node #1 is not fixed
    				if ( node[member[i].n0].teta_fix.x == 0 ) { //if node #3 is not fixed
    					k_var.AddNewElement( FreeDeg*n_number[member[i].n0]+1,	FreeDeg*n_number[member[i].n0] +3,	6*EJz/member[i].L*tmp				);} //k(1,3)
    				if ( node[member[i].n1].teta_fix.x == 0 ) {	//if node #9 is not fixed
    					k_var.AddNewElement( FreeDeg*n_number[member[i].n0]+1,	FreeDeg*n_number[member[i].n1] +3,	6*EJz/member[i].L*tmp				);} //k(1,9)
    			}
    			if ( node[member[i].n0].u_fix.z == 0 ) { //if node #2 is not fixed
    				if ( node[member[i].n0].u_fix.x == 0 ) { //if node #0 is not fixed
    					k_var.AddNewElement( FreeDeg*n_number[member[i].n0]+2,  FreeDeg*n_number[member[i].n0],		12*EJy/pow(member[i].L,2)*tmp 	);} //k(2,0)
    				if ( node[member[i].n1].u_fix.x == 0 ) { //if node #6 is not fixed
    					k_var.AddNewElement( FreeDeg*n_number[member[i].n0]+2,  FreeDeg*n_number[member[i].n1],		-12*EJy/pow(member[i].L,2)*tmp 	);} //k(2,6)
    			}
    			if ( node[member[i].n0].teta_fix.y == 0 ) { //if node #4 is not fixed
    				if ( node[member[i].n0].u_fix.x == 0 ) { //if node #0 is not fixed
    					k_var.AddNewElement( FreeDeg*n_number[member[i].n0]+4,	FreeDeg*n_number[member[i].n0],		-6*EJy/member[i].L*tmp 			);} //k(4,0)
    				if ( node[member[i].n1].u_fix.x == 0 ) { //if node #6 is not fixed
    					k_var.AddNewElement( FreeDeg*n_number[member[i].n0]+4,	FreeDeg*n_number[member[i].n1],		6*EJy/member[i].L*tmp 			);} //k(4,6)
    			}
    			if ( node[member[i].n0].teta_fix.z == 0 ) { //if node #5 is not fixed
    				if ( node[member[i].n0].teta_fix.x == 0 ) { //if node #3 is not fixed
    					k_var.AddNewElement( FreeDeg*n_number[member[i].n0]+5,  FreeDeg*n_number[member[i].n0] +3,	4*EJz*tmp				);} //k(5,3)
    				if ( node[member[i].n1].teta_fix.x == 0 ) {	//if node #9 is not fixed
    					k_var.AddNewElement( FreeDeg*n_number[member[i].n0]+5,  FreeDeg*n_number[member[i].n1] +3,  2*EJz/member[i].L*tmp 	);} //k(5,9)
    			}
    			if ( node[member[i].n1].u_fix.y == 0) { //if node #7 is not fixed
    				if ( node[member[i].n0].teta_fix.x == 0 ) { //if node #3 is not fixed
    					k_var.AddNewElement( FreeDeg*n_number[member[i].n1]+1,	FreeDeg*n_number[member[i].n0] +3,	-6*EJz/member[i].L*tmp 			);} //k(7,3)
    				if ( node[member[i].n1].teta_fix.x == 0 ) {	//if node #9 is not fixed
    					k_var.AddNewElement( FreeDeg*n_number[member[i].n1]+1,	FreeDeg*n_number[member[i].n1] +3,	-6*EJz/member[i].L*tmp 			);} //k(7,9)
    			}
    			if ( node[member[i].n1].u_fix.z == 0 ) { //if node #8 is not fixed
    				if ( node[member[i].n0].u_fix.x == 0 ) { //if node #0 is not fixed
    					k_var.AddNewElement( FreeDeg*n_number[member[i].n1]+2,  FreeDeg*n_number[member[i].n0],		-12*EJy/pow(member[i].L,2)*tmp 	);} //k(8,0)
    				if ( node[member[i].n1].u_fix.x == 0 ) { //if node #6 is not fixed
    					k_var.AddNewElement( FreeDeg*n_number[member[i].n1]+2,  FreeDeg*n_number[member[i].n1],		12*EJy/pow(member[i].L,2)*tmp 	);} //k(8,6)
    			}
    			if ( node[member[i].n1].teta_fix.y == 0 ) { //if node #10 is not fixed
    				if ( node[member[i].n0].u_fix.x == 0 ) { //if node #0 is not fixed
    					k_var.AddNewElement( FreeDeg*n_number[member[i].n1]+4,	FreeDeg*n_number[member[i].n0],		-6*EJy/member[i].L*tmp			);} //k(10,0)
    				if ( node[member[i].n1].u_fix.x == 0 ) { //if node #6 is not fixed
    					k_var.AddNewElement( FreeDeg*n_number[member[i].n1]+4,	FreeDeg*n_number[member[i].n1],		6*EJy/member[i].L*tmp 			);} //k(10,6)
    			}
    			if ( node[member[i].n1].teta_fix.z == 0 ) {	//if node #11 is not fixed
    				if ( node[member[i].n0].teta_fix.x == 0 ) { //if node #3 is not fixed
    					k_var.AddNewElement( FreeDeg*n_number[member[i].n1]+5,  FreeDeg*n_number[member[i].n0] +3,	2*EJz*tmp 				);} //k(11,3)
    				if ( node[member[i].n1].teta_fix.x == 0 ) {	//if node #9 is not fixed
    					k_var.AddNewElement( FreeDeg*n_number[member[i].n1]+5,  FreeDeg*n_number[member[i].n1] +3,	4*EJz*tmp 				);} //k(11,9)
    			}
    		}		
    		
    		//SUM(Lzi * Lyi),   i=x0,y0,z0
    		tmp = 0;
    		for (j=0;j<3;j++) {
    			tmp += member[i].V[2][j] * member[i].V[1][j];}
    		if (tmp > LENGTH_EPS) {
    			if ( node[member[i].n0].u_fix.y == 0 ) { //if node #1 is not fixed
    				if ( node[member[i].n0].teta_fix.y == 0 ) { //if node #4 is not fixed
    					k_var.AddNewElement( FreeDeg*n_number[member[i].n0]+1,	FreeDeg*n_number[member[i].n0] +4,	6*EJz/member[i].L*tmp			); //k(1,4)
    					k_var.AddNewElement( FreeDeg*n_number[member[i].n0]+4,	FreeDeg*n_number[member[i].n0] +1,	-6*EJy/member[i].L*tmp 			); //k(4,1)
    				}
    				if ( node[member[i].n1].teta_fix.y == 0 ) { //if node #10 is not fixed
    					k_var.AddNewElement( FreeDeg*n_number[member[i].n0]+1,	FreeDeg*n_number[member[i].n1] +4,	6*EJz/member[i].L*tmp			); //k(1,10)
    					k_var.AddNewElement( FreeDeg*n_number[member[i].n1]+4,	FreeDeg*n_number[member[i].n0] +1,	-6*EJy/member[i].L*tmp			); //k(10,1)
    				}
    			}
    			if ( node[member[i].n1].u_fix.y == 0) { //if node #7 is not fixed
    				if ( node[member[i].n0].teta_fix.y == 0 ) { //if node #4 is not fixed
    					k_var.AddNewElement( FreeDeg*n_number[member[i].n0]+4,	FreeDeg*n_number[member[i].n1] +1,	6*EJy/member[i].L*tmp 			); //k(4,7)
    					k_var.AddNewElement( FreeDeg*n_number[member[i].n1]+1,	FreeDeg*n_number[member[i].n0] +4,	-6*EJz/member[i].L*tmp 			); //k(7,4)
    				}
    				if ( node[member[i].n1].teta_fix.y == 0 ) { //if node #10 is not fixed
    					k_var.AddNewElement( FreeDeg*n_number[member[i].n1]+1,	FreeDeg*n_number[member[i].n1] +4,	-6*EJz/member[i].L*tmp 			); //k(7,10)
    					k_var.AddNewElement( FreeDeg*n_number[member[i].n1]+4,	FreeDeg*n_number[member[i].n1] +1,	6*EJy/member[i].L*tmp 			); //k(10,7)
    				}
    			}
    
    ..............................еще 10 страниц

    математики... бессмысленные и беспощадные.

    FadeToBlack, 04 Октября 2014

    Комментарии (7)
  7. C++ / Говнокод #16769

    +57

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    30. 30
    31. 31
    32. 32
    33. 33
    34. 34
    class C3D
    {
    public:
      //C3D()  {}  // Constructor
      //~C3D()  {}  // Destructor
    
      void(*init)(float R, float A, float B, float Rmin, float Rmax, float Bmin, float Bmax);  // Initialize work with 3D standard camera
      void(*setCamera)(int iType);  // Set type of camera
      void(*setPosition)(float x, float y, float z);  // Set position
      void(*setRender3D)();
      UINT(*addMesh)(LPCWSTR sMesh);  // Add Mesh
      void(*renderMesh)(UINT idMesh, float x, float y, float z);
      void(*renderMeshSubset)(UINT idMesh, UINT idSubset, float x, float y, float z);
      void(*renderMeshSubsetRotateX)(UINT idMesh, UINT idSubset, float x, float y, float z, float a);
    // простыня указателей на функции урезана
    
      void setHModule(HMODULE hLib)
      {
        m_hLib = hLib;
    
        (FARPROC &)init = GetProcAddress(m_hLib, "init3D");  // Initialize work with 3D standard camera
        (FARPROC &)setCamera = GetProcAddress(m_hLib, "setCamera");  // Set type of camera
        (FARPROC &)setPosition = GetProcAddress(m_hLib, "setPosition");  // Set position
        (FARPROC &)setRender3D = GetProcAddress(m_hLib, "setRender3D");
        (FARPROC &)addMesh = GetProcAddress(m_hLib, "addMesh");  // Add Mesh
        (FARPROC &)renderMesh = GetProcAddress(m_hLib, "renderMesh");
        (FARPROC &)renderMeshSubset = GetProcAddress(m_hLib, "renderMeshSubset");
        (FARPROC &)renderMeshSubsetRotateX = GetProcAddress(m_hLib, "renderMeshSubsetRotateX");
    // простыня GetProcAddress урезана
      }
    
    protected:
      HMODULE  m_hLib;  // NetWars.dll
    };

    Некий SDK для MMO-игр за авторством одного известного разработчика.

    bazhenovc, 25 Сентября 2014

    Комментарии (50)
  8. C++ / Говнокод #16767

    +60

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    vector <float> items; 
    float *x;
    for(int i = 0; i<100; i++) { 
      x = new float; 
      *x = 1.0f; 
      items.push_back(*x); 
    };

    оттуда...

    Try, 25 Сентября 2014

    Комментарии (9)
  9. C++ / Говнокод #16762

    +59

    1. 1
    2. 2
    3. 3
    4. 4
    std::transform( keyframes.begin(), keyframes.end(), std::back_inserter( result ),
          boost::bind( & qMakePair< KeyframeType::first_type, KeyframeType::second_type >,
             boost::bind( & Prm::TType::view, _1 ),
             boost::bind( & Prm::Time::value, boost::bind( & Prm::TType::time, _1 ) ) ) );

    boost bind головного мозга

    QBatman, 24 Сентября 2014

    Комментарии (143)
  10. C++ / Говнокод #16754

    +62

    1. 001
    2. 002
    3. 003
    4. 004
    5. 005
    6. 006
    7. 007
    8. 008
    9. 009
    10. 010
    11. 011
    12. 012
    13. 013
    14. 014
    15. 015
    16. 016
    17. 017
    18. 018
    19. 019
    20. 020
    21. 021
    22. 022
    23. 023
    24. 024
    25. 025
    26. 026
    27. 027
    28. 028
    29. 029
    30. 030
    31. 031
    32. 032
    33. 033
    34. 034
    35. 035
    36. 036
    37. 037
    38. 038
    39. 039
    40. 040
    41. 041
    42. 042
    43. 043
    44. 044
    45. 045
    46. 046
    47. 047
    48. 048
    49. 049
    50. 050
    51. 051
    52. 052
    53. 053
    54. 054
    55. 055
    56. 056
    57. 057
    58. 058
    59. 059
    60. 060
    61. 061
    62. 062
    63. 063
    64. 064
    65. 065
    66. 066
    67. 067
    68. 068
    69. 069
    70. 070
    71. 071
    72. 072
    73. 073
    74. 074
    75. 075
    76. 076
    77. 077
    78. 078
    79. 079
    80. 080
    81. 081
    82. 082
    83. 083
    84. 084
    85. 085
    86. 086
    87. 087
    88. 088
    89. 089
    90. 090
    91. 091
    92. 092
    93. 093
    94. 094
    95. 095
    96. 096
    97. 097
    98. 098
    99. 099
    100. 100
    #include<iostream>
    #include<clocale>
    #include<fstream>
    #include<cstring>
    using namespace std;
    int main()
    {
        setlocale(LC_ALL,"RUS");
        int cnt=0,cnt2=0,cnt3=0,cnt4=0;
        int iMax=93;
        bool bPassword=1;
        char password[6];
        char cBuffer[5]="";
        char cSymbols[]=",<.>/?;:'|[{]}`~!@#$%^&*()-_=/№0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHILKLMNOPQRSTUVWXYZ";
        char cClear[]="";
        cout<<"Введите пароль:";
        cin>>password;
        cout<<"Брать ли в перебор символы?(1 - да , 0 - нет):";
        bool bSymbols;
        cin>>bSymbols;
        cout<<"Брать ли в перебор цифры?(1 - да , 0 - нет):";
        bool bNumbers;
        cin>>bNumbers;
        cout<<"Брать ли в перебор буквы нижнего регистра?(1 - да , 0 - нет):";
        bool bDownRegister;
        cin>>bDownRegister;
        cout<<"Брать ли в перебор буквы верхнего регистра?(1 - да , 0 - нет):";
        bool bUpRegister;
        cin>>bUpRegister;
        while(bPassword)
        {
            if(!bSymbols){if(cnt>=0&&cnt<31){cnt++;continue;}}
            if(!bNumbers){if(cnt>=31&&cnt<41){cnt++;continue;}}
            if(!bDownRegister){if(cnt>=31&&cnt<67){cnt++;continue;}}
            if(!bUpRegister){if(cnt>=67&&cnt<iMax){cnt++;continue;}}
            cBuffer[0]={cSymbols[cnt]};
            bPassword=strcmp(password,cBuffer);
            cout<<"cBuffer:"<<cBuffer<<endl;
            if(bPassword){strcpy(cBuffer,cClear);}
            if(cnt==iMax)
            {
                cnt=0;
                while(bPassword)
                {
                    if(!bSymbols){if(cnt>=0&&cnt<31){cnt++;continue;}}
                    if(!bNumbers){if(cnt>=31&&cnt<41){cnt++;continue;}}
                    if(!bDownRegister){if(cnt>=31&&cnt<67){cnt++;continue;}}
                    if(!bUpRegister){if(cnt>=67&&cnt<iMax){cnt++;continue;}}            
                    if(!bSymbols){if(cnt2>=0&&cnt2<31){cnt2++;continue;}}
                    if(!bNumbers){if(cnt2>=31&&cnt2<41){cnt2++;continue;}}
                    if(!bDownRegister){if(cnt2>=31&&cnt2<67){cnt2++;continue;}}
                    if(!bUpRegister){if(cnt2>=67&&cnt2<iMax){cnt2++;continue;}}
                    cBuffer[0]={cSymbols[cnt2]};
                    cBuffer[1]={cSymbols[cnt]};
                    bPassword=strcmp(password,cBuffer);
                    cout<<"cBuffer:"<<cBuffer<<endl;
                    if(bPassword){strcpy(cBuffer,cClear);}
                    if(cnt2==iMax&&cnt==iMax)
                    {
                        cnt2=0;
                        cnt=0;
                        while(bPassword)
                        {
                            if(!bSymbols){if(cnt>=0&&cnt<31){cnt++;continue;}}
                            if(!bNumbers){if(cnt>=31&&cnt<41){cnt++;continue;}}
                            if(!bDownRegister){if(cnt>=31&&cnt<67){cnt++;continue;}}
                            if(!bUpRegister){if(cnt>=67&&cnt<iMax){cnt++;continue;}}
                            if(!bSymbols){if(cnt2>=0&&cnt2<31){cnt2++;continue;}}
                            if(!bNumbers){if(cnt2>=31&&cnt2<41){cnt2++;continue;}}
                            if(!bDownRegister){if(cnt2>=31&&cnt2<67){cnt2++;continue;}}
                            if(!bUpRegister){if(cnt2>=67&&cnt2<iMax){cnt2++;continue;}}
                            if(!bSymbols){if(cnt3>=0&&cnt3<31){cnt3++;continue;}}
                            if(!bNumbers){if(cnt3>=31&&cnt3<41){cnt3++;continue;}}
                            if(!bDownRegister){if(cnt3>=31&&cnt3<67){cnt3++;continue;}}
                            if(!bUpRegister){if(cnt3>=67&&cnt3<iMax){cnt3++;continue;}}
                            cBuffer[0]={cSymbols[cnt3]};
                            cBuffer[1]={cSymbols[cnt2]};
                            cBuffer[2]={cSymbols[cnt]};
                            bPassword=strcmp(password,cBuffer);
                            cout<<"cBuffer:"<<cBuffer<<endl;
                            if(bPassword){strcpy(cBuffer,cClear);}
                            if(cnt3>=iMax&&cnt2>=iMax&&cnt>=iMax)
                            {
                                cnt3=0;
                                cnt2=0;
                                cnt=0;
                                while(bPassword)
                                {
                                    if(!bSymbols){if(cnt>=0&&cnt<31){cnt++;continue;}}
                                    if(!bNumbers){if(cnt>=31&&cnt<41){cnt++;continue;}}
                                    if(!bDownRegister){if(cnt>=31&&cnt<67){cnt++;continue;}}
                                    if(!bUpRegister){if(cnt>=67&&cnt<iMax){cnt++;continue;}}
                                    if(!bSymbols){if(cnt2>=0&&cnt2<31){cnt2++;continue;}}
                                    if(!bNumbers){if(cnt2>=31&&cnt2<41){cnt2++;continue;}}
                                    if(!bDownRegister){if(cnt2>=31&&cnt2<67){cnt2++;continue;}}
                                    if(!bUpRegister){if(cnt2>=67&&cnt2<iMax){cnt2++;continue;}}
                                    if(!bSymbols){if(cnt3>=0&&cnt3<31){cnt3++;continue;}}
                                    if(!bNumbers){if(cnt3>=31&&cnt3<41){cnt3++;continue;}}
                                    if(!bDownRegister){if(cnt3>=31&&cnt3<67){cnt3++;continue;}}
                                    if(!bUpRegister){if(cnt3>=67&&cnt3<iMax){cnt3++;continue;}}

    Брутфорс 2014 (!).

    Exclumice, 23 Сентября 2014

    Комментарии (43)