#include <iostream>
#include <string>
#include <conio.h>
#include <cstdlib>
using namespace std;
int main()
{
int menu;
N: cin.clear();
cin.sync();
cout<<"\n[3] Zaszyfruj na Szyfr Cezara";
cout<<"\n\n[4] deszyfruj";
cout<<"\n\nWybieram: "; cin>>menu;
if(menu==4) goto O;
if(menu==3) goto F;
else goto N;
F: cin.clear();
cin.sync();
string tekst;
cout<<"\n_______________________________________\n\n";
cout<<"Podaj tekst do zaszyfrowania: ";
cin >>tekst;
for(int i=0;i<=tekst.length();i++){
if(tekst[i]>=65 && tekst[i]<=90-3) tekst[i]=int(tekst[i])+3;
else if(tekst[i]>=91-3 && tekst[i]<=90) tekst[i]=int(tekst[i])-26+3;
else if(tekst[i]>=97 && tekst[i]<=122-3) tekst[i]=int(tekst[i])+3;
else if(tekst[i]>=123-3 && tekst[i]<=122) tekst[i]=int(tekst[i])-26+3;
}
cout<<"\n\nZaszyfrowany tekst: "<<tekst<<endl;
goto N;
//-------------------------------------------------------------
O:
cin.clear();
cin.sync();
string ttkst;
cout<<"\n_______________________________________\n\n";
cout<<"Podaj tekst do deszyfrowania: ";
cin >>ttkst;
for(int i=0;i<=ttkst.length();i++){
if(ttkst[i]>=65 && ttkst[i]<=90+3) ttkst[i]=int(ttkst[i])-3;
else if(ttkst[i]>=91+3 && ttkst[i]<=90) ttkst[i]=int(ttkst[i])-26-3;
else if(ttkst[i]>=97 && ttkst[i]<=122+3) ttkst[i]=int(ttkst[i])-3;
else if(ttkst[i]>=123+3 && ttkst[i]<=122) ttkst[i]=int(ttkst[i])-26-3;
}
cout<<"\n\nZaszyfrowany tekst: "<<ttkst<<endl;
goto N;
}
Nie działa.. Czemu?
Program ma szyfrować kodem Cezara i odszyfrowywać.