Back to General discussions forum
i did the code and i think it works good, i think it do what the problem expect to do, but when i submit it the expected answer is "Error: Data pointer is decremented below zero with "<" operation" i donĀ“t understand what does it means with HERE IS A SAMPLE TEXT TO BE ENCRYPTED BUT YOUR CODE WILL BE TESTED ON ANOTHER ONE. the answer is IFSF JT B TBNQMF UFYU UP CF FODSZQUFE CVU ZPVS DPEF XJMM CF UFTUFE PO BOPUIFS POF me code is
#include <stdio.h>
char cadena[100]={"0"};
char alfa[26]={'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'};
char encry[100];
int main (void)
{
int i=0;
while(cadena[i]!='.')
{
i++;
scanf("%c",&cadena[i]);
for(int k=0; k<26; k++)
{
if(cadena[i]==alfa[k]) encry[i]=alfa[k+1];
else if(cadena[i]==32) encry[i]=32;
else if(cadena[i]=='Z') encry[i]=alfa[0];
}
}
for(int j=1; j<i;j++)
{
printf("%c",encry[j]);
}
}
Hi Karol!
I'm afraid you misunderstood something. This task (#168) should be solved in specific language, brainf**k
, not C.
You probably wanted to solve another task about caesar cipher, probably #47.