Help in starting the code

0 Nikolai Illyich · March 27, 2015
I've been wanting to create this program for quite some time now, but I just could not figure out how or where to start. I want to make a program that does a basic substitution cipher based on an input integer. For example, I type first '3', then the next message I type is "ABC", then each letter is moved an n number of letters on the alphabet line. So "ABC" becomes "DEF". And then "DEF" is output on the screen.

What I can't figure out is, how do I initialize and set all of this up? Do i create variables for each of the letter of the alphabet and for each lower and uppercase? But also, how do I make the code skip the spaces? Also, how do I add the increment for the letters? I can't do a = a + 3 if a is a char right?

I would appreciate some help here, maybe some code snippet to start me off.

Post a Reply

Replies

Oldest  Newest  Rating
+1 James Juan · March 28, 2015
, .try this. its not perfect but i hope it will help.. 

    char a[]={'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 c[100];
    int b;
    cout<<"enter number: ";
    cin>>b;
    cin.ignore();
    cout<<"enter string: ";
    cin.getline(c,sizeof(c));
    for(int i=0; i<b; i++){
        for(int d=0; d<26; d++){
            if(c==a[d]){
                cout<<a[d+b];
            }
        }
    }
  • 1

C++

107,331 followers
About

Used in many types of software including music players, video games, and many large scale applications.

Links
Moderators
Bucky Roberts Administrator