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.
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
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.
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()
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.
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.