c - Substitution Cipher printing table -


so of right now, substitution cipher program seems work pretty nicely; however, still having problem.

i must print substitution table such below, table must printed output file before encryption :

example:

a m

b n

etc...

z q

a p

b o

etc...

z x

0 5

1 4

etc...

9 0

/encrypted message here/

code:

#include <stdio.h> char input[]={'\n',' ','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','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','0','1','2','3','4','5','6','7','8','9'}; char encrypted[]={'\n',' ','m','n','b','v','c','x','z','a','s','d','f','g','h','j','k','l','p','o','i','u','y','t','r','e','w','q','p','o','i','u','y','t','r','e','w','q','a','s','d','f','g','h','j','k','l','m','n','b','v','c','x','z','5','4','3','2','1','6','7','8','9','0'};  int c; //int j=0;  int main(){     file *file1=fopen("projectinput.txt", "r");     file *file2=fopen("projectoutput.txt", "w");     //fprintf(file2,"%c %c\n",input[j++],encrypted[j++]);     while((c=fgetc(file1))!=eof){         int i=0;         while(input[i]!=c){             i++;         }         fputc(encrypted[i], file2);  } return 0; } 

use fprintf in loop:

for(int = 2; < sizeof input; i++)     fprintf(file "%c %c\n", input[i], encrypted[i]); 

Comments

Popular posts from this blog

opencv - DataType<cv::detail::deriv_type>::depth what is it used for -

Why can rails not find a route created by a helper? -

javascript - jquery or ashx not working -