I originally had all this code in one source file because I misread the assignment instructions. Then I saw it said please do NOT have all this code in one source file and I thought that made much more sense.
It compiled just fine when I had everything in my main.cpp, but now it's giving me:
error: invalid types 'char[int]' for array subscript"
In my main I have the array declared like:
#include "CaesarEncryptDecrypt.h"
using namespace std;
string pFile, cFile;
char textFile{1000};
int main()
{
//rest of main code...
and in my header I have it declared like:
// Globals
extern string pFile, cFile;
extern char textFile;
but then it gets to my two source code files and it shows errors here:
void encrypt (int shift, ifstream & plainTextFile, ofstream & cipherFile){
char letter;
int i = 0;
while(!plainTextFile.eof()){
plainTextFile.get(textFile[i]);
/* 'error: invalid types 'char[int]' <--This error shows up at
every instance of me trying to use textFile
array. */
i++;
}
I'm sure I've missed something obvious here.