Program Menu which will choose whether imported string will encode or will decode .Coding and decoding will be dealt with 2 functions.
Key encoding: The text used letters of the alphabet and numbers.Each letter string which is odd, it is being replaced by point two places after her in alphabet.Last letters Y, Z are replaced by A, B consequently .Even letters the sting does not suffer any changes. Odd numbers are replaced by the even numbers are their followers and steam are replaced by their odd precursor.Number 9 is coded to 0 and 0 to the ninth
The task to test two strings.First to encode and then encoded version to decode .Strings be placed in files and from there to take.
Here is code i have written, but it have some error. Anybody can help?
#include <stdio.h>
#include <ctype.h>
#include<iostream>
#include<string>
#include<fstream>
#define MAXVEL 100
using namespace std;
void kodiranje(char kod[])
{
int i=0;
while(kod)
{
if(i%2!=0)
{
if(isalpha(kod[i]))
if(kod[i]=='Y') kod[i]='A';
else
if (kod[i]=='Z') kod[i]='B';
else
kod=kod+2;
}
if(!isalpha(kod[i]))
{
if(kod[i]=='0') kod[i]='9';
else
if(kod[i]=='9') kod[i]='0';
else
{
if(kod[i]% 2!=0)
kod= kod ++;
else
kod[i]=kod[i]-1;
}
}
i++;
}
printf("%s",kod);
}