Fixing error in program “Need Help”
I am getting this error with when I compile. I have to turn this assignment in a few hours. Here is the code:
error message(s)
untitled.cpp:34: error: invalid types ‘int[int]’ for array subscript
untitled.cpp:36: error: invalid types ‘int[int]’ for array subscript
// A basic Casear Cipher Encrytion Device.
include <iostream>
include <iomanip>
using namespace std;
define RINGLEN 62
-
// NUM OF CHARS IN ALLOWED CHARACTER SET.
int main () { int i=0; // index variables int j=0; char ring[RINGLEN+1]="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; int key = 4; const int size = 1000; char word[size+1];
-
cout << "Please insert the message you would like to encrypt: ";
- cin >> word;
- for (int i=0;i<size;i++)
- {
- if ((word[i] >='A' && word[i] <='Z') || (word[i]>='a'&&word[i]<='z') ||(word[i]>='0'&&word[i]<='9'))
- {
- int ring = word[i] + key;
- for (int j=0; j<=RINGLEN;j++)
- {
- if (word[i] == ring[j])
- {
- cout << ring[(j+key) % RINGLEN];
- break;
- }
- }
- }
- else
- {
- cout << word[i];
- }
- }
- return 0;
}
Please help