int main(int argc, char** argv) { std::ifstream in_file(argv[1]); std::string input((std::istreambuf_iterator<char_type>(in_file)), std::istreambuf_iterator<char_type>()); std::transform(input.begin(), input.end(), input.begin(), caesar_cipher(std::atoi(argv[2]))); std::ofstream out_file("caesar_cipher.txt"); std::cout << input << std::endl; out_file << input; }
int main(int argc, string argv[]) { //Verify the command-line argument exists if (argc != 2) { printf("Try again with a positive number\n"); return 1; } else { //Convert the cipher to an integer from a string int cipher = atoi(argv[1]); string phrase = GetString(); //Set the cypher to be 0-25 cipher = cipher % 26; //print the return of the caesar_cipher() function printf("%s\n", caesar_cipher(cipher, phrase)); } }