This is my first time on this site, and I appreciate any help on my issue. I am in my first class in C ++ and I admit that I am not an expert in computer programming, so if you could make your answers as deep as possible, this would greatly help my newbie condition.
I will create a program that decodes encrypted text files. Files consist of several sets of ten integers. Depending on the file, the file has a number of random values up to a number for each character. For example, a file may have three random numbers than a number representing a character, then another three random numbers than the next number representing a character, etc.
The program should ask the user for an input file, then an output file and the number of random numbers for skips before each legal integer / character. Please note that my program should be able to handle any number of leading random numbers. This means that before the legal one, it can have three random numbers or thirty random numbers.
Here is my entire program so far. The function that I need to create is called skipVariable, if someone could help me create this function, it would be so useful, I looked at it for hours, and I just can’t imagine how to complete this task.
#include <iostream>
#include <fstream>
using namespace std;
const char SPACE = ' ';
void programTitle();
void promptUser ( string &IN_FILE_NAME, string &OUT_FILE_NAME, int &SKIP_NUMBER);
bool openInputFile( ifstream &inf, const string &fileName );
int skipVariable (int SKIP_NUMBER);
int main ()
{
ifstream fin;
string IN_FILE_NAME, OUT_FILE_NAME;
int SKIP_NUMBER;
programTitle();
promptUser ( IN_FILE_NAME, OUT_FILE_NAME, SKIP_NUMBER);
openInputFile( fin, IN_FILE_NAME);
skipVariable ( SKIP_NUMBER);
fin.close();
cout << endl << endl;
system( "pause" );
return 0;
}
void programTitle()
{
cout << " DECODER PROGRAM" << endl;
cout << " ===============";
cout << endl << endl;
}
void promptUser ( string &IN_FILE_NAME, string &OUT_FILE_NAME, int &SKIP_NUMBER)
{
cout << "Enter input file name: " ;
cin >> IN_FILE_NAME;
cout << endl;
cout << "Enter output file name: " ;
cin >> OUT_FILE_NAME;
cout << endl;
cout << "Enter number of items to skip: " ;
cin >> SKIP_NUMBER;
cout << endl << endl << endl;
cout << "Processing Data . . ." << endl << endl;
}
bool openInputFile( ifstream &inf, const string &fileName )
{
inf.clear();
inf.open( fileName.c_str() );
return inf.good();
}
int skipVariable (int SKIP_NUMBER)
{
return 0;
}
source
share