It's ok when I use uppercase letters, but I get random stuff when I use lower case letters
#include <iostream>
#include <conio.h>
using namespace std;
string sentence, key;
int todo, koef, keylenth, senlenth;
int main()
{
cout<<"Do not use spaces!"<<endl<<endl;
cout<<endl<<endl<<"Key: "; //enter the key
cin>>key;
keylenth = key.length();
char *keymas = new char[keylenth];
key.copy(keymas, keylenth, 0);
cout<<endl<<"Enter the message: ";
cin>>sentence;
cout<<endl<<endl<<"Сiphered message: ";
senlenth = sentence.length();
char *massentence = new char[senlenth];
sentence.copy(massentence, senlenth, 0);
for(int i=0; i<keylenth; i++) {
for(int j=i; j<senlenth; j+=keylenth) {
if((int)keymas[i]>=65 && (int)keymas[i]<=90) koef=64;
if((int)keymas[i]>=97 && (int)keymas[i]<=122) koef=96;
(int)massentence[j];
(int)keymas[i];
if(massentence[j]>=97 && massentence[j]<=122) {
massentence[j]+=keymas[i]-koef;
if(massentence[j]>122) massentence[j]-=26; }
if(massentence[j]>=65 && massentence[j]<=90) {
massentence[j]+=keymas[i]-koef;
if(massentence[j]>90) massentence[j]-=26; }
}
}
for(int i=0; i<senlenth; i++) cout<<massentence[i];
getch();
}