Welcome to Dream.In.Code
Getting C++ Help is Easy!

Join 131,728 C++ Programmers for FREE! Get instant access to thousands of C++ experts, tutorials, code snippets, and more! There are 2,345 people online right now. Registration is fast and FREE... Join Now!




Vigenere table.

 
Reply to this topicStart new topic

Vigenere table.

chadly724
post 11 Dec, 2006 - 06:02 PM
Post #1


New D.I.C Head

*
Joined: 26 Oct, 2006
Posts: 14


My Contributions


i've been trying how to form a vigenere table in C++ for a project i'm doing, but i can't figure it out. i'm trying to use string arrays. here's what i have so far...

CODE
    char ALPH[26]= {'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'};
    
    char VIG[ROWS][COLS];

    for(int i=0; i<ROWS; i++)
    {
        for(int j=0; j<COLS; j++)
        {
            VIG[i][j]=ALPH;
        }

    }


here i was just trying to print the array to make sure i was doing it right... but i can't even get taht.

thanks. chadly
User is offlineProfile CardPM

Go to the top of the page

eXceed69
post 11 Dec, 2006 - 06:46 PM
Post #2


"Super Sentai Knight Of DawN"

Group Icon
Joined: 12 Nov, 2006
Posts: 682



Thanked 1 times

Dream Kudos: 675
My Contributions


did you declare the variable rows and cols..they should be int ROWS, COLS, and be equal to zero...can you post the whole code??
User is offlineProfile CardPM

Go to the top of the page

chadly724
post 11 Dec, 2006 - 06:54 PM
Post #3


New D.I.C Head

*
Joined: 26 Oct, 2006
Posts: 14


My Contributions


sorry... i should have known to post it all... i should add that this is just as far as i've got. i still have no real clue as to how to set it up so that it is a vigenere table.

CODE

#include <iostream>
using namespace std;
//global variables for vig array
const int ROWS(26);
const int COLS(26);

int main ()
{
    //i want to use this array to fill the first row of VIG.
    char ALPH[26]= {'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'};
    
    //define our VIG 2-d array.
    char VIG[ROWS][COLS];
    
    //i loop to cycle thru the rows
    for(int i=0; i<ROWS; i++)
    {
        //j loop to cycle thru columns
        for(int j=0; j<COLS; j++)
        {
            //this sets each value in the array to its
            //corresponding one from "ALPH"?
            VIG[i][j]=ALPH;
        }


    }

    cout<<VIG;








    return 0;
}


even broad suggestions would be appreciated. i'm really in a "coders block" here and i need to get this done soon.

thanks
User is offlineProfile CardPM

Go to the top of the page

Xing
post 11 Dec, 2006 - 07:05 PM
Post #4


D.I.C Addict

Group Icon
Joined: 22 Jul, 2006
Posts: 723



Thanked 2 times

Dream Kudos: 1575
My Contributions


Is this what you are looking for
VIG[i][j]=ALPH[j];
User is offlineProfile CardPM

Go to the top of the page

chadly724
post 11 Dec, 2006 - 07:35 PM
Post #5


New D.I.C Head

*
Joined: 26 Oct, 2006
Posts: 14


My Contributions


QUOTE(Xing @ 11 Dec, 2006 - 08:05 PM) *

Is this what you are looking for
VIG[i][j]=ALPH[j];


yes crazy.gif
User is offlineProfile CardPM

Go to the top of the page

eXceed69
post 11 Dec, 2006 - 07:41 PM
Post #6


"Super Sentai Knight Of DawN"

Group Icon
Joined: 12 Nov, 2006
Posts: 682



Thanked 1 times

Dream Kudos: 675
My Contributions


Now you had notice it....biggrin.gif
User is offlineProfile CardPM

Go to the top of the page

chadly724
post 11 Dec, 2006 - 08:12 PM
Post #7


New D.I.C Head

*
Joined: 26 Oct, 2006
Posts: 14


My Contributions


how can i make it a vigenere table though. i need to make the second row start with B, and end with A. then keep shifting 1 left and moving the first letter to the end...

any ideas.

thanks for the help by the way!
User is offlineProfile CardPM

Go to the top of the page

Reply to this topicStart new topic
Time is now: 11/20/08 10:22AM

Live C++ Help!

C++ Tutorials

Reference Sheets

C++ Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month