Programming help

Pages: 12
Jan 6, 2015 at 10:27pm
I need to make a program that is able to take in a 4 letter uppercase password, and then it will go into a loop that will start at AAAA...AAAB...AAAC...AAAD...etc until it reaches the input.
Jan 7, 2015 at 12:49am
If this isn't an assignment... Why?

If this is an assignment, then what have you written so far?
Jan 7, 2015 at 10:42am
make 4 loops looping each position
Jan 8, 2015 at 9:01pm
This is an assignment, and heres what i have so far:
#include <iostream>
#include <cstring>
using namespace std;
int main ()
{
system ("Color 2");
char password[5];
char "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z";
cout << "Please enter a five digit letter only password:";
cin >> password;
-----------------------------------------------------------------------------------------------------------------------
for(int i = 'A'; i < 'Z' + 1; ++i)
if (frequency_table[i] != 0)
std::cout << (c = i) << ": " << frequency_table[i] << '\n';

I know that I need to use the code under the dashes somewher but im not sure how or where
Jan 8, 2015 at 9:08pm
And Armon safii its not that easy becuase you cannot make a for loop counter with letters. I need to be able to convert the letters into numbers which is what the code under the dashes needs to do.
Jan 8, 2015 at 9:54pm
Please edit your post and make sure that your code is [code]between code tags[/code] so that it has syntax highlighting and line numbers.
Jan 8, 2015 at 10:30pm
I need to make a program that is able to take in a 4 letter uppercase password, and then it will go into a loop that will start at AAAA...AAAB...AAAC...AAAD...etc until it reaches the input.


did you worked with combinations before?

1. you have to make all 4 letter combinations.
2. then you get all permutatuons by next_permutation()

one and only one of the permutations is correct.

EDIT: http://www.cplusplus.com/articles/L8hv0pDG/
Last edited on Jan 9, 2015 at 5:30am
Jan 10, 2015 at 4:50pm
Ok wow lol thats really cool program, but i need it to not generate passwords, but to check them.
Jan 21, 2015 at 6:48pm
Any help?
Jan 22, 2015 at 1:04pm
1
2
3
4
5
6
7
8
9
string pass1 = "akl";
string pass2 = "ghr";
string input;
cin >> input;

if(input == pass1  || input == pass2) 
{
   cout << "access granted!";
}
Jan 22, 2015 at 5:10pm
Ummm correct me if I'm wrong, but I'm pretty sure that that program make the user guess the password? I want the computer to try every possible combination in order to try and guess the password.
Jan 22, 2015 at 5:18pm
i need it to not generate passwords,


I want the computer to try every possible combination in order to try and guess the password.


do you understand they are inconsistent ?
Jan 22, 2015 at 6:35pm
what is inconsistent?
Jan 22, 2015 at 6:55pm
you must generate passwords (combinations/permutations) to find correct one.

if it "guesses" like a lottery it wont be the right password.
Jan 22, 2015 at 7:07pm
No, it guesses the users input...
Jan 22, 2015 at 7:10pm
xHyperionx wrote:
...its not that easy becuase you cannot make a for loop counter with letters
Sure you can!

1
2
3
4
5
6
7
8
9
10
11
12
13
for(char firstChar = 'A'; firstChar <= 'Z'; ++firstChar)
{
    for(char secondChar = 'A'; secondChar <= 'Z'; ++secondChar)
    {
        for(char thirdChar = 'A'; thirdChar <= 'Z'; ++thirdChar)
        {
            for(char fourthChar = 'A'; fourthChar <= 'Z'; ++fourthChar)
            {
                std::cout << firstChar << secondChar << thirdChar << fourthChar << std::endl;
            }
        }
    }
}
Last edited on Jan 22, 2015 at 7:10pm
Jan 22, 2015 at 7:12pm
wait is that actually all there is to it?
lol
and how do i make one so that its not case sensitive and it works for both A and a...?
Jan 22, 2015 at 8:16pm
No, it guesses the users input

do you want only one random guess?
if you try all possible permutations then that cannot be called "guess" !
................
booradley60's program finds all permutations in uppercase.

now if you want a mix of upper and lower eg AaZy, or even include digits, you need function calls in place of the increments.
Jan 22, 2015 at 8:30pm
Ok, like what kind of function calls?
Jan 23, 2015 at 3:43am
Ok, like what kind of function calls?


function which will tell what ++firstChar means.

because, A to Z is continuous, then what will be the next increment ?
Pages: 12