int main(int argc, char *argv[]) { Cipher code; //creating object int c; c = getopt(argc, argv,"ed:"); if(c == 'e'){//encrypt message code.setKey(atoi(optarg)); int offSet = code.getKey(); c = getopt(argc, argv,"f:"); if(c == 'f'){ code.setFileName(optarg); string fileOpen = code.getFileName(); code.cipherDoc(fileOpen, offSet); code.printMsg(); } else { cout<<"Did not provide a file"<<endl; } } if(c == 'd'){//decrypt message code.setKey(atoi(optarg)); int offSet = code.getKey(); c = getopt(argc, argv,"f:"); if(c == 'f'){ code.setFileName(optarg); string fileOpen = code.getFileName(); code.decipherDoc(fileOpen, offSet); code.printMsg(); } else { cout<<"Did not provide a file"<<endl; } } /* while((c = getopt(argc, argv,"f:")) != 'n'){ //Just in case other doesn't work if(c == 'f'){ string fileOpen = Cipher.setFileName(optarg); } else { string z = optarg; z = 'n'; } }*/ return 0; }