有人可以帮助我实现这一目标吗? Thx提前。 [英] Can someone help me make this come true ? Thx in advance .
问题描述
所以最近我决定制作一个密码生成器,提示大量的char。在密码中,然后提示我遇到的任何类型的字符(az,AZ,0-9,还有一些和自定义的字符),然后输出所有可能的
密码组合到txt文件。然而我无法找到解决方案,请帮助我,提示和调试意味着很多。至于我已经得到的错误,他们都是不同的没有错误,告诉我,我有类型不匹配,
但它在某种形式的代码,如堆栈溢出一,这花了我一天了解。我会上传我的流程,所以你可以亲自看看,proj 1
So recently i decided to make a password generator that , prompts for amount of char. in a password , then prompts for whatever type of char(a-z , A-Z , 0-9 , and some more and a custom one ) that i had a hard time with , which then outputs all the possible combinations of the password to a txt file . And yet i cant find the solution , please help me , tips and debugging would mean much. As for the errors i've been getting , well they are all different no errors that tell me that i have a mismatch in types , but its in some form of code like the stack overflow one , that took me a day to understand . I will upload my process ,so you can see for yourselves, proj 1
#include "stdafx.h"
#include <iostream>
#include <fstream>
#include <cmath>
#include <string>
#include <stdlib.h>
#include <istream>
using namespace std;
int main()
{
ofstream THEOUTPUT("BLYAT.txt");
string S1[26]; string S2[26]; string S3[26]; string S4[26]; string S5[26]; string S6[26]; string S7[26]; string S8[26]; string S9[26]; string S10[26]; string S11[26]; string S12[26];
string PASSWORD[6000]; string SHITPASS[6000]; int n = 0; int m = 0; int x = 0; int y = 0; int counter = 1; string SS;
char chars[26];//small , caps , numbers
int z = 0; string SSS; string SSSS; int k = 0;
char specificchars[100];
int lol = 0;
while (1<5)
{
for (int a = 9; a<123; a++)
{
int counter1 = a - 97;
S1[counter1] = (char)a;
cout << S1[counter1] << endl;
}
for (int a = 97; a<123; a++)
{
int counter2 = a - 97;
S2[counter2] = (char)a;
cout << S2[counter2] << endl;
}
for (int a = 97; a<123; a++)
{
int counter3 = a - 97;
S3[counter3] = (char)a;
cout << S3[counter3] << endl;
}
while (counter != 2000)
{
if (S2[lol] == "y" && S3[z] == "z") lol++;
PASSWORD[n] = S1[x] + S2[lol] + S3[z];
if (S2[lol] == "z" && S3[z] == "z")
{
x++;
}
if (S2[lol] == "y" && S3[z] == "z")
{
z = 0;
}
if (S3[z] == "z")
{
lol++;
k++;
}
if (k == 1)
{
z = -1;
k = 0;
}
if (S2[lol] == "z")
{
x++;
lol = 0;
}
z++;
THEOUTPUT << counter << " " << PASSWORD[n] << endl;
n++;
counter++;
if (S1[x] == "z" && S2[lol] == "z" && S3[z] == "z")//exit
{
break;
}
}
// PASSWORD[n]=S1+S2+S3+S4+S5+S6+S7+S8+S9+S10+S11+S12;
}
system("PAUSE");
return 0;
THEOUTPUT.close();
}
因此,我所有努力的要点归结为这段代码,但是我试图让它发生它永远不会发生,那就产生了密码来自26个小字符,每个单独的3个字符位置。再次提前致谢。
So the gist of all my efforts comes down to this piece of code , however i try to make it happen it never does, thats generates the passwords from 26 small characters , on 3 character places for every separate one. Thanks in advance again.
推荐答案
while (1<5)
{
for (int a = 9; a<123; a++)
{
int counter1 = a - 97;
S1[counter1] = (char)a;
cout << S1[counter1] << endl;
}
for (int a = 97; a<123; a++)
{
int counter2 = a - 97;
S2[counter2] = (char)a;
cout << S2[counter2] << endl;
}
for (int a = 97; a<123; a++)
{
int counter3 = a - 97;
S3[counter3] = (char)a;
cout << S3[counter3] << endl;
}
while (counter != 2000)
{
if (S2[lol] == "y" && S3[z] == "z") lol++;
PASSWORD[n] = S1[x] + S2[lol] + S3[z];
if (S2[lol] == "z" && S3[z] == "z")
{
x++;
}
if (S2[lol] == "y" && S3[z] == "z")
{
z = 0;
}
if (S3[z] == "z")
{
lol++;
k++;
}
if (k == 1)
{
z = -1;
k = 0;
}
if (S2[lol] == "z")
{
x++;
lol = 0;
}
z++;
THEOUTPUT << counter << " " << PASSWORD[n] << endl;
n++;
counter++;
if (S1[x] == "z" && S2[lol] == "z" && S3[z] == "z")//exit
{
break;
}
}
// PASSWORD[n]=S1+S2+S3+S4+S5+S6+S7+S8+S9+S10+S11+S12;
}
system("PAUSE");
return 0;
THEOUTPUT.close();
}
对于初学者我建议你设置警告等级4并进行重建。
然后纠正任何问题。
> while(1< 5)
因为这将永远是真的,你如何摆脱这个循环?
我看到一个打破;声明,但这是在另一个while()循环内,所以在
它将导致内循环退出。但是这个外循环呢?
$
>返回0;
> THEOUTPUT。 close();
返回语句之后的任何内容都不会被执行,因为它永远无法到达。
- Wayne
For starters I suggest that you set Warning Level 4 and do a rebuild.
Then correct any issues.
>while (1<5)
Since this will always be true, how do you get out of this loop?
I see one break; statement, but that is inside another while() loop so
it will cause that inner loop to exit. But what about this outer loop?
>return 0;
>THEOUTPUT.close();
Nothing after a return statement will ever be executed as it can never be reached.
- Wayne
这篇关于有人可以帮助我实现这一目标吗? Thx提前。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!