Need help with program.

This is a discussion on Need help with program. within the C++ Programming forums, part of the General Programming Boards category; The program is very sloppy, but i know whats going on with it, anyway.. this is my first post so ...

  1. #1
    Registered User
    Join Date
    Jun 2006
    Posts
    2

    Need help with program.

    The program is very sloppy, but i know whats going on with it, anyway.. this is my first post so i dont know what all i need to do, like if i need to paste my code in here or whatever. But im making a vigenere decypher, that figures out the keylength and key. So far ive shifted the cipher, our teacher want us to use chi-squared, but if we cant figure out how to use it, to use another way. Anyway i couldnt figure out how to use chi squared or dot product rule. I dont want the program wrote for me just help on it. Thanks

    edit:: i gues i should have posted my question in here. Anyway my question is, is if anyone can help me on figuring out how to use chi squared of on the dot product rule
    Last edited by kingsleysurf; 06-11-2006 at 05:40 PM.

  2. #2
    carry on JaWiB's Avatar
    Join Date
    Feb 2003
    Location
    Seattle, WA
    Posts
    1,972
    Well, the dot product method is explained pretty well here.

    Have you managed to write your program to find the (likely) key length yet? That would seem to be the first logical step.
    "Think not but that I know these things; or think
    I know them not: not therefore am I short
    Of knowing what I ought."
    -John Milton, Paradise Regained (1671)

    "Work hard and it might happen."
    -XSquared

  3. #3
    Registered User
    Join Date
    Jun 2006
    Posts
    2
    yes, i have that is what the shifts were for, i believe thtats what i undersdtood from the vigenere, the key length i believe is 9.

    and thanks for the website the only problem i have is that the cipher is small and im not quite sure how to run a loop? maybe to check to see if the letters are the same. and it seems like the for loop i run just repeats itself and only checks 1,10,19th letters over and over

    sorry if the code comes out sloppy, its my first time to post this

    Code:
    for (int q=0; q<28; q++)
         {      
             for (int p=q; p<28; p++)
         {
             fi=0;
             ca++;
             for (int x=p+9; x<28; x++)
             {
                   for (i=p+18; i<28; i++)
                 {
                    if ((a[x]==a[p])||(a[p]==a[i])||(a[x]==a[p]))
                    {                         
                             d[ca]=fi+1;
                             
                    }            
    
                    break;
                 }
                 break;
             }       
         }
         }
    i also wanted to know if i understood this correctly what i do is check the frequencey of the 1,10,19th letters and divide them by whatever the total number is then make another table correct?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Issue with program that's calling a function and has a loop
    By tigerfansince84 in forum C++ Programming
    Replies: 9
    Last Post: 11-12-2008, 01:38 PM
  2. Need help with a program, theres something in it for you
    By engstudent363 in forum C Programming
    Replies: 1
    Last Post: 02-29-2008, 01:41 PM
  3. Replies: 4
    Last Post: 02-21-2008, 10:39 AM
  4. My program, anyhelp
    By @licomb in forum C Programming
    Replies: 14
    Last Post: 08-14-2001, 11:04 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21