Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

C++ newb

Name: jfx 2011-02-23 15:05

Hi, could anybody c++ programmer please tell me how following code should look like, if it shouldnt be in a function.

I need it seperate so i can stop it when it found a specific combination/password.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -


#include <iostream>
#include <string>
#include <fstream>
#include <windows.h>

using namespace std;
char str[255];
int many;


ofstream file ("list.txt");

void swap(char* first, char* second)
{
        char ch = *second;
        *second = *first;
        *first = ch;
}

int permute(char* set, int begin, int end)
{

        int i;
        int range = end - begin;
        if (range == 1) {

                file<<set<<endl;
                cout << set << endl;


        } else {
                for(i=0; i<range; i++) {
                        swap(&set[begin], &set[begin+i]);               //initial swap
                        permute(set, begin+1, end);                             //recursion
                        swap(&set[begin], &set[begin+i]);       //swap back
                }
        }
        return 0;
}



int main()
{
    SetConsoleTitleA("Rainbow Attack");
    std::cout << "Rainbow Attack 4" << endl;



        cout << "Set: ";
        cin.getline(str, 255); //take string

        permute(str, 0, strlen(str)); //permutate the string
        cout << endl << "Done" << endl;
        file.close();
        return 0;
}

Name: Anonymous 2011-02-23 15:08

It should like it's been posted with code tags

Name: Anonymous 2011-02-23 15:09

:S

Name: Anonymous 2011-02-23 15:38

>>1
No.

Name: Anonymous 2011-02-23 16:26

Sorry, I only help people who use code tags.

Name: Anonymous 2011-02-23 16:27

take it easy!~~

Name: Anonymous 2011-02-23 18:04

Rainbow Attack. YES!!

Don't change these.
Name: Email:
Entire Thread Thread List