Been trying to make a substitution cipher decrypter, but it isn't working especially good. so I thought I might could get some help with it.

#include <iostream>
#include <time.h>
#include <windows.h>
#include <iomanip.h>
#include <string.h>

using namespace std;

int main()
{
    
    
    bool EndThisShit(false);
    do {
    string input;
    cin >> input;
    int il;
    input.length() = il;
    int Ninput[il];
    Ninput[il] = input
    int y;
    for( y = 0; y < il; y++){
    int t =1;
    Ninput[fo] + t;
    i++;
    t++;
}
 int a;
 for(a = 0; a < il; a++) {
       enum letter {  a = 97, 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};
       int b = 0;
       cout Ninput[b] 
       b++; 
       }    
       cout << " is this a good solution? y/n >> ";
       char yn;
       cin >> yn; 
       if(yn == y) {
             EndThisShit = true;
             }
       if(yn == n) {
             EndThisShit = false;
             }
}while(!EndThisShit);
}

Recommended Answers

All 4 Replies

What is it supposed to do. Maybe you can give sample input, current (incorrect) output, and expected output.

What is it supposed to do. Maybe you can give sample input, current (incorrect) output, and expected output.

well it's supposed to give differet solutions to a Substitution cipher (http://en.wikipedia.org/wiki/Substitution_cipher)
it should be writing a possible solutions and if it's the correct then finish it of, and if it's not it shall give another suggestion, until it finds the right one. right now nothing happends, all I get is an error message saying " `width' has not been declared" it's supposed to give every letter a specific array, then convert it to numbers, then add an increasing number to the letter number, then convert it back to the letter that is the increasing number after it. and then type it out.

#include <iostream>
#include <time.h>
#include <windows.h>
#include <iomanip.h>
#include <string.h>

using namespace std;

int main()
{
    
    
    bool EndThisShit(false);
    do {
    char input;
    cin >> input;
    int Ninput[1000];
    int li;
    li = input.width();
    Ninput[1000] = input;
    int Veckt[li];
    int fo=0;
    int letters[fo];
    
    int y;
    for(y = 0; y < li; y++){
    int t =1;
    Veckt[fo] = Ninput[fo] + t;
    Veckt[fo] = (char)letters[fo];
    fo++;
    t++;
}
 int a;
 for(a = 0; a < li; a++) {
       int bo = 0;
       cout << letters[fo]; 
       bo++; 
       }    
       cout << " is this a good solution? y/n >> ";
       char yn;
       cin >> yn; 
       if(yn == 'y') {
             EndThisShit = true;
             }
       if(yn == 'n') {
             EndThisShit = false;
             }
}while(!EndThisShit);
}

New code!

What are all those headers for? Comments would also be nice so we can see what your doing.
Are you incrementing every character by one, and if the input is 'n', you increment every number again? What happens when you go past the printible character range?

What are all those headers for? Comments would also be nice so we can see what your doing.
Are you incrementing every character by one, and if the input is 'n', you increment every number again? What happens when you go past the printible character range?

well I'm going to use the headers later, like adding some color and so on. And when I overcome the printable range (for the moment) nothing happends, then it's just not a substitution cipher and it's just to close the window down.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.