Help with my programm!

So here is what I am trying to do i made a program thet finds the right password (for now the password is contained only with intengers, later im planing to do it with leaters to) here is the code of thet program:


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#include <iostream>

using namespace std;

int main(){
    int password = 3523;

    bool runing = true;

    int trypass = 0;

    while(runing){

        trypass++;

        if(trypass == password){

        cout << "The correct password is: " << trypass << "!";
        return 0;

        }

    }
}



So I need to adjust the program above to try out to hack the password in my other programm (it only asks you for pass until you dont enter the right pass)
Here is the code for my programm thet simulates a login or something where I need to hack the password:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include <iostream>

using namespace std;

//main function
int main(){
    bool runing = true;

    int pass = 2693; //the pass i need to hack with the program above
    int cin_pass;   //here shoud be the trypass variable from the programm above

    while(runing){
        cout << "Enter password: ";
        cin >> cin_pass;    //here it shoud get the information from the programm above

        if(cin_pass == pass){ //checking if the password is right
            cout << "\nSucessful loged in!";
            return 0;
        }
    }
}



Ty all for help!
Last edited on
After-all I don't understand purpose of your program if you are trying to brute-force than i can only say this is the worst way for a brute-force also if you are comparing two passwords.
changed the first program this is way better finding right password under 0.5 sec if it is a smaller intenger like 25234 now i need a way to do the same thing in the second program
Last edited on
I think you really are Beginners do you really think the second code needs any correction. please run the code on your PC and see what it does. THERE IS NO NEED OF CORRECTION.
Topic archived. No new replies allowed.