| | |
substitution cipher help
![]() |
•
•
Join Date: Jun 2009
Posts: 38
Reputation:
Solved Threads: 2
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.
c++ Syntax (Toggle Plain Text)
#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); }
Last edited by kangarooblood; Jul 4th, 2009 at 7:25 am.
// Maybe you like C++ put I prefer A++...
•
•
Join Date: Jun 2009
Posts: 38
Reputation:
Solved Threads: 2
•
•
•
•
What is it supposed to do. Maybe you can give sample input, current (incorrect) output, and expected output.
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.
c++ Syntax (Toggle Plain Text)
#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!
Last edited by kangarooblood; Jul 4th, 2009 at 9:54 am.
// Maybe you like C++ put I prefer A++...
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?
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?
"Sometimes, when I lie in bed at night and look up at the stars, I think to myself, "Man! I really need to fix that roof."-Jack Handy
•
•
Join Date: Jun 2009
Posts: 38
Reputation:
Solved Threads: 2
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.
// Maybe you like C++ put I prefer A++...
![]() |
Similar Threads
- Need help with substitution cipher in Javascript (JavaScript / DHTML / AJAX)
- Need help with Caesar Cipher program (Java)
- Chars becoming negative. (C++)
- Python challenge help (Python)
- Help With Caesar Cipher/Shift (Pascal and Delphi)
- Cryptography Fun (Python)
- Caesar cipher problem with CHR(32) (Visual Basic 4 / 5 / 6)
Other Threads in the C++ Forum
- Previous Thread: hey guys could u check my code PLEASE its a code with a "text file"
- Next Thread: Segmentation Fault
| Thread Tools | Search this Thread |
api array based binary bitmap business c++ c/c++ char class classes code codesamplerunwhilecommands coding commentinghelp compile console conversion count decide delete deploy desktop developer directshow dll download dynamic dynamiccharacterarray email encryption error faq file forms fstream function functions game givemetehcodez graph guess gui hash homeworkhelp homeworkhelper iamthwee ifpug ifstream incrementoperators infinite input int integer java lib linkedlist linker listing loop looping loops map math matrix memory multiple news node output pointer port problem proficiency program programming project python random read recursion reference rpg string strings temperature template test text text-file tree url variable vector video win32 windows winsock wordfrequency wxwidgets





