Rotational Decypher I have all the libraries I think I need, what it is that I\'
ID: 646002 • Letter: R
Question
Rotational Decypher
I have all the libraries I think I need,
what it is that I'm trying to write, is a code that will take arg[1] and decypher it by rotating the characters until a word that matches the dictionary from argv[2] is true. I want to put argv[1] into an array and the dictionary from argv[2] into an array so I can compare them. I don't really have a clue as to what I'm doing, I just know what I need to do and not sure on how to implent it. The for loop where i=-50; i<51 is because the codes we have to decypher will have a key between -50,50
#include <Stdio.h>
#include <rotUtlis.h>
#include <stdlib.h>
#include <ctype.h>
#include <strings.h>
int main(int argc, char *argv[]){
//read array
FILE *fp;
fp = fopen(argv[1], "r");
File *pf;
pf=fopen(argv[2], "r");
char c;
c=fgetc(fp)
int n;
int rotate(c, n);
bool found;
//length of first string
int size = strlen(const char *s);
//create array of size [size] using coded message, and create array of dictionary words.
int array[size];
int dictionary[];`
//store first string of characters into an array
for(i=0; i<size; i++){
array[i] = c;
dictionary[i] = ;
}
//rotate characters in string untill = dictionary word
while(found!=true){
found = true
for(i=-50; i<51; i++){
rotate(int, int);
}
}
//read first string
//rotate characters in string n times
//compare result with dictionary
//if match not found - repeat
//if match found - key = n
//ARRAY OF PRINTABLE CHARACTERS?
return 0;
}