密码破解程序组合程序
Password Cracker Combination Program
我在分配作业时遇到了一些麻烦。我有一个包含 30 个单词的字符串数组。我必须组合其中三个词来形成密码组合。"airairair"或"allallall"等组合是可以接受的。我知道我应该有 27000 种组合(30 * 30 * 30),但到目前为止我只得到了 900 种。有人可以帮助我吗?我做错了什么?代码如下:
#include<iostream>
#include<string>
#include<list>
#include<fstream>
using namespace std;
int main(int argc, char **argv[])
{
string passwords[] = { "air", "few", "all", "one", "cot", "jam", "sip", "gag", "arc", "egg",
"had", "hut", "tan", "paw", "pay", "got", "get", "pea", "rig", "cop",
"sat", "two", "who", "six", "sow", "dam", "tip", "lit", "awl", "dew" };
static int numWords = 0;
static int count = 0;
int arrLength = sizeof(passwords) / sizeof(passwords[0]);
ofstream f("passwords.dat"); //write passwords to file
int i, j, k;
for (i = 0; i < arrLength; i++)
{
for ( j = 0; i < arrLength; i++)
{
for ( k = 0 ; k < arrLength; k++)
{
cout << passwords[i] << passwords[j] << passwords[k];
f << passwords[i] << passwords[j] << passwords[k] << "n";
}
}
}
f.close();
system("pause");
return 0;
}
你的J循环是错误的。应该是for( j=0 ; j < arrLength; j++)
.
但是,它被错误地键入为 for( j=0 ; i < arrLength ; i++ )
因此,它将只提供
相关文章:
- Mongodb c++驱动程序:如何查询元素的数组
- C++,系统无法执行指定的程序
- 在C++程序中输入的文本文件将不起作用,除非文本被复制和粘贴
- 在VS代码中交叉编译Windows与Linux上的MinGW的SDL程序
- 如何将独立的 c 应用程序组合到 c++ 应用程序中?
- 找不到如何创建使用指针、字符和 for 函数组合的程序
- C++对象文件和程序文件组合编译的 Bashrc 别名
- 如何指示/打印基于斐波那契数字的程序的不同组合
- 制作需要接受字母和数字组合的密码类型程序
- 生成k数字的NCK组合的程序从1到n不等
- 在自定义组合框下拉列表控件上等待超过5秒会导致win32 C++应用程序在Windows7中挂起
- 我用c ++编写了组合程序,但没有输出,任何人都可以说出原因吗?
- 我可以将一个可执行文件与另一个可执行文件(Windows 服务程序)组合在一起,并将该程序作为逻辑服务运行吗?
- 密码破解程序组合程序
- IM 创建一个 C++ 程序,其中用户可以尝试 2 次尝试密码用户名组合.如果他们无法获得它,他们的程序就会停止
- 我的聚合、关联和组合关系在这个C++程序中不起作用
- 这是我的程序编写每十亿个组合的一种更有效的方式
- 如何组装、链接和编译c++、NASM文件和.o驱动程序的组合
- 矢量的元素太多.组合程序
- 将不同的线程方法组合到Windows窗体应用程序中