I need help with Caesar's Cipher

Write a C++ program that asks the user for the name of an input file and translates the contents of that input file using ROT13. Your main function should be responsible for reading the input file and coordinating calls to a function named Rot 13 that will do the translation for each character and WriteTranslatedChar that will write the translated character to a secondary file. The Rot13 function should be defined with a reference parameter that will be the initial character as input and the translated character as output. The second function named WriteTranslatedChar will have two parameters, the translated character and a reference to an ofstream data type for a secondary file named "output.rot13", and write a translated character to this file.


//Include statements
#include <iostream>
#include <string>
#include <fstream>

using namespace std;

//Global declarations: Constants and type definitions only -- no variables

//Function prototypes
void Rot13();
void WriteTranslatedChar();


int main()
{
//In cout statement below substitute your name and lab number
cout << "Brayden McMillan -- Lab Number 6" << endl << endl;

//Variable declarations
ifstream infile;
ofstream outfile;
char x;

//Program logic
infile.open("input.txt");
if (!infile){
cout << "Can't opent the input file.";
return 1;
}
outfile.open("output.txt");
if (!infile){
cout << "Can't opent the output file.";
return 1;
}

cout << "type the name of the input file" << endl; //ask the user for the name of the input file
//infile.open()




//Closing program statements
system("pause");
return 0;
}

//Function definitions
void Rot13()
{

}
void WriteTranslatedChar()
{

}

Last edited on
I don't see your questions.

Please use code tags with the code.
Last edited on
I do not understand what goes in the void statements and I need help with the variable declarations
I do not understand what goes in the void statements

void statements are statements which evaluate to nothing. I think you mean "I don't understand what goes in the functions I must write that return nothing." You should probably start by making the signatures reflect the requirements you enumerated in the first post.
I need help with the variable declarations

I guess you are referring to the "[i]function should be defined with a reference parameter ...[i]"

See: http://www.cplusplus.com/doc/tutorial/functions/
Topic archived. No new replies allowed.