Hello. I study programming at college and I'm a beginner. So I must make a menu with one Decryption and a Encryption but a get different error and I don't know to to fix them.
If someone can help?
Thanks.
Sorry for the modification! First I used Borland C++ 5.0.2 and now I change to codeblocks.
Some of the lines are from the teacher, but he doesn't explain well, and some are from google.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
|
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <tchar.h>
#include <iostream>
using namespace std;
void criptare (char[250])
{
int i;
for(i=0; i<strlen(a); i++)
if(a[i] = 'z' && a[i] = 'a')
a[i] = a[i]-32;
cout<<a<<"\n";
for(i=0;i<strlen(a);i++)
if(a[i] <= 'Z' && a[i] >= 'A')
if(a[i] == 'A')
a[i] = 'Z';
else
if(a[i] == 'B')
a[i]='Y';
else
if(a[i] == 'C')
a[i] = 'Z';
else
a[i] = a[i]-3;
cout<<a<<"\n";
}
int main()
{
char nrOptiune,sir[250]
for(;;)
{
system("cls");
cout<<"1. Decriptare Caesar.\n";
cout<<"2. Criptare transpozitie matrice.\n";
cout<<"3. Iesire.\n";
cout<<"\nAlegeti un numar: \n";
nrOptiune=getch();
if(nrOptiune=='1')
{
cout<<"\nDecriptare Caesar.\n";
cout<<"Tastati un sir de caractere: \n";
gets(sir);
criptare(sir);
cout<<"Apasati o tasta pentru a reveni.";
getch();
}
else if(nrOptiune=='2')
{
cout<<"\nCriptare transpozitie matrice.\n";
cout<<"Apasati o tasta pentru a reveni.";
getch();
}
else
break;
}
|
ERRORS
C:\Users\Andrei\Documents\1\123\main.cpp||In function 'void criptare(char*)':|
C:\Users\Andrei\Documents\1\123\main.cpp|12|error: 'a' was not declared in this scope|
C:\Users\Andrei\Documents\1\123\main.cpp|15|error: 'a' was not declared in this scope|
C:\Users\Andrei\Documents\1\123\main.cpp|17|warning: suggest explicit braces to avoid ambiguous 'else' [-Wparentheses]|
C:\Users\Andrei\Documents\1\123\main.cpp||In function 'int main()':|
C:\Users\Andrei\Documents\1\123\main.cpp|34|error: expected initializer before 'for'|
C:\Users\Andrei\Documents\1\123\main.cpp|34|error: expected primary-expression before ')' token|
C:\Users\Andrei\Documents\1\123\main.cpp|34|error: expected ';' before ')' token|
C:\Users\Andrei\Documents\1\123\main.cpp|33|warning: unused variable 'nrOptiune' [-Wunused-variable]|
C:\Users\Andrei\Documents\1\123\main.cpp|60|error: expected '}' at end of input|