Thread: Help with complex program

  1. #1
    Registered User
    Join Date
    Apr 2005
    Posts
    39

    Help with complex program

    I am in need of a program. I am not sure how to program such a thing, so I'll ask for help.

    1. I need to make this program calculate the total number of possible combinations of letters and/or numbers in an entered amount of digits. (example: entered 1 digit for numbers only and you get: 10. Enter two digits for numbers only and get: 100. ect.) There must be some sort of formula, but I am not sure what it is.

    2. Is is possible with C++ to have this program make the mouse click at specified x,y and to have the program type in text and deleate text? If so, then how would I go about doing this? If no, then what language could accomplish this?

  2. #2
    Registered User
    Join Date
    Apr 2003
    Posts
    2,663
    1.
    (example: entered 1 digit for numbers only and you get: 10.
    10^1

    Enter two digits for numbers only and get: 100. ect.)
    10^2

    It's generally refered to as a the "decimal number system" or "base 10". "dec" in "decimal" means 10.

    2. I'm sure it's possible with C++. One way: get "Ivor Horton's Beginning Visual C++" which will teach you C++ and then windows programming with MS VC++. It's about 1,000 pages long.
    Last edited by 7stud; 04-25-2005 at 10:08 PM.

  3. #3
    Registered User
    Join Date
    Apr 2005
    Posts
    39
    Quote Originally Posted by 7stud
    10^1

    10^2

    It's generally refered to as a the "decimal number system" or "base 10". "dec" in "decimal" means 10.
    Yes I'm sure that works....but what is the formula for adding in letters? (lowercase only)

  4. #4
    Registered User
    Join Date
    Apr 2003
    Posts
    2,663
    How many letters are in the alphabet?

  5. #5
    Toaster Zach L.'s Avatar
    Join Date
    Aug 2001
    Posts
    2,686
    Lets say you have n possible letters/numbers/symbols.

    For one place, you have n possible combinations.
    For two places, you have n choices for the first one, and then you have n choices for the second (for each choice of the first) yielding n*n = n^2 possible combinations.

    You should be able to extrapolate from there.
    The word rap as it applies to music is the result of a peculiar phonological rule which has stripped the word of its initial voiceless velar stop.

  6. #6
    Registered User
    Join Date
    Apr 2003
    Posts
    2,663
    You should be able to extrapolate from there.
    ....not quite.

    edit: well, never mind.
    Last edited by 7stud; 04-25-2005 at 11:40 PM.

  7. #7
    Registered User
    Join Date
    Apr 2005
    Posts
    39
    Therefore, it must be 36^#of spaces I believe.
    Well that parts done...

    Now about the auto clicking/typing/deleating.

    Ok, so what I am trying to do is:

    Create a program which finds out all the possible combinations for the entered number of spaces. Then I want to make it so you can specify an x,y coordinate for the mouse to click, what it types in, and what it deleates. Once that is set up, you enter the time it takes between the click to the time of the next typing (to explain that I want it to type in something, then click at a spot, then deleate what it was typing, and then type another thing, and repeat). Then, the program clicks on the designated places, and types in all of the possible combinations (see beginning) one by one. The program should also have a pause and resume button, so you can pause it whenever you wish (possibly even save your process).

    I believe that that should be doable. If you do not understand something fully, feel free to ask.

  8. #8
    Registered User
    Join Date
    Jan 2005
    Posts
    847
    The second part is operating system dependant. In Microsoft Windows I think you could use WindowFromPoint followed by sending WM_SETTEXT to the returned handle with SendMessage.

  9. #9
    Registered User
    Join Date
    Apr 2005
    Posts
    39
    does anyone know how i could program this?

  10. #10
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    Yes, but we're not here to hand it over on a plate for you.

    It's up to you to make the first move, post what you can achieve and then we help you along the way.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  11. #11
    Registered User
    Join Date
    Apr 2005
    Posts
    39
    Quote Originally Posted by Salem
    Yes, but we're not here to hand it over on a plate for you.

    It's up to you to make the first move, post what you can achieve and then we help you along the way.
    Yeah i guess your right. I'm planning to do everything except clicking, typing and deleating in the next week or so, once i get some free time . I am confident that I can do at least that part.

  12. #12
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    Well so long as you don't try something dumb like another recent poster ("Please help by midnight"), then there's usually plenty of time for you to try a little bit, get stuck, post a question, get an answer and move on.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  13. #13
    Registered User
    Join Date
    Apr 2005
    Posts
    39
    So, I am starting with the other nessasary things, but I already ran into a problem...

    I wrote the code needed to make a window (I believe), but I keep getting an error I can't figure out.
    The Error is:

    Code:
    [Linker error] undefined reference to "GetStockObject@4"
    id returned 1 exit status
    [Build Error] [windowmenu.exe] Error 1
    I use Dev C++ 4.9.9.2

    The code is...

    Code:
    #define WIN32_LEAN_AND_MEAN
    #include <windows.h>
    #include <windowsx.h>
    #include <stdio.h>
    #include <math.h>
    #define WINDOW_CLASS_NAME "WINCLASS1"
    HWND main_window_handle = NULL;
    //////////////////////////////////////
    LRESULT CALLBACK WindowProc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
    {
            PAINTSTRUCT ps;
            HDC hdc;
            switch(msg)
            {
             case WM_CREATE:
             {return(0);} break;
             case WM_PAINT:
             {hdc=BeginPaint(hwnd,&ps);
             EndPaint(hwnd,&ps);
             return(0);} break;
             case WM_DESTROY:
             {PostQuitMessage(0);
             return(0);}break;
            default:break;
            }
    }
    //////////////////////////////////////
    int WINAPI WinMain(HINSTANCE hinstance, HINSTANCE hprevinstance, LPSTR lpcmdline, int ncmdshow)
    {
        WNDCLASS winclass;
        HWND hwnd;
        MSG msg;
        winclass.style=CS_DBLCLKS | CS_OWNDC | CS_HREDRAW | CS_VREDRAW;
        winclass.lpfnWndProc=WindowProc;
        winclass.cbClsExtra=0;
        winclass.cbWndExtra=0;
        winclass.hInstance=hinstance;
        winclass.hIcon=LoadIcon(NULL,IDI_APPLICATION);
        winclass.hCursor=LoadCursor(NULL,IDC_ARROW);
        winclass.hbrBackground=(HBRUSH)GetStockObject(BLACK_BRUSH);
        winclass.lpszMenuName=NULL;
        winclass.lpszClassName=WINDOW_CLASS_NAME;
        if(!RegisterClass(&winclass))
         return(0);
        if (!(hwnd=CreateWindow(WINDOW_CLASS_NAME,
         "Title",
         WS_OVERLAPPEDWINDOW | WS_VISIBLE,
         0,0,
         320,200,
         NULL,
         NULL,
         hinstance,
         NULL)))
        return(0);
        main_window_handle=hwnd;
        while(1)
        {
          if(PeekMessage(&msg,NULL,0,0,PM_REMOVE))
          {
            if(msg.message==WM_QUIT) break;
            TranslateMessage(&msg);
            DispatchMessage(&msg);
          }
        }
    }
    That is the code that my C++ book has in it. If you know of a better way to do make a window, feel free to say so.

  14. #14
    Registered User
    Join Date
    Apr 2005
    Posts
    39
    Anybody? Please help, I can't figure it out.

  15. #15
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    When you created a new project in dev-c++, did you choose a windows program?
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Using variables in system()
    By Afro in forum C Programming
    Replies: 8
    Last Post: 07-03-2007, 12:27 PM
  2. BOOKKEEPING PROGRAM, need help!
    By yabud in forum C Programming
    Replies: 3
    Last Post: 11-16-2006, 11:17 PM
  3. Can someome help me with a program please?
    By WinterInChicago in forum C++ Programming
    Replies: 3
    Last Post: 09-21-2006, 10:58 PM
  4. 2 am complex double conversion woes
    By Roule in forum C++ Programming
    Replies: 1
    Last Post: 10-14-2004, 02:53 PM
  5. My program, anyhelp
    By @licomb in forum C Programming
    Replies: 14
    Last Post: 08-14-2001, 10:04 PM