I've been trying to create a program in c to encrypt a text, but I'm still learning many commands in c.
So far I have created a string "char text [200]" to save my text. Then I created two .txt files. one with the letters in order and the other the way I want to encrypt.
ex: arq1 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 "
arq2 "z y x w v u t s r q p o n m l k j i h g f e d c b a"
Thus, where 'a' turns 'z', 'b' turns 'and', etc.
I figured I could compare each letter of the text to the letter of arq1 and then say that it equals arq2.
ex: c = arq1 [2], then it checks on arq2 [2] and says q 'c' will get 'x'
My problem is to compare these files because I started to see the basics of fopen and fclose now.
I imagine I can do this + - like this:
#include<stdio.h>
int main(){
char text[200];
int i;
int j=0;
...
scanf("%s",text);
for(i=0;i<(int)text;i++)
{
While(text[i]=!arq1[j])
{
j++;
}
if(text[i]==arq1[j])
{
text[i]=arq2[j];
}
}
return 0;
}