#include <iostream>
#include <fstream>
using namespace std;
bool nextChar(char ¶m);
int main(void)
{
ifstream inFile;
bool hasRunBefore;
inFile.open("C:\\Program Files\\ID tracker\\has run.txt");
if(inFile)
{
cout << "Running this program can cause data-loss. If you have stored \
any data already, please save it before continuing.\nPress \
enter to continue . . ." << endl;
cin.sync();
cin.get();
}
else
{
ofstream outFile;
outFile.open("C:\\Program Files\\ID tracker\\has run.txt");
outFile << "Do not delete this file. You may modify it though.";
outFile.close();
}
char char1, char2;
char1 = char2 = 96;
ofstream outFile;
string pathName;
while(nextChar(char1))
{
while(nextChar(char2))
{
pathName = (string) "C:\\Program Files\\ID tracker\\Database\\" + char1 + "\\" + char2 + ".txt";
outFile.open(pathName.c_str());
cout << "Created " << pathName << endl;
outFile.close();
}
}
cout << "The database has been constructed.";
cin.sync();
cin.get();
return 0;
}
bool nextChar(char ¶m)
{
// If the char is 'Z' then break outta main's loop.
// Else increment it and return true to remain in the loop.
if(param == 122)
param = 48;
else if(param == 57)
param = 96;
return false;
++param;
return true;
}
Thank you for reading this topic.

New Topic/Question
Reply




MultiQuote



|