will do ill message you right now, btw this is that code commented
Code:
#include <iostream>
#include <fstream>
#include <string>
#include <windows.h>
using namespace std;
void menu(void);//void because im not sending or recieving any values
int main(int argc, char *argv[])//command line parameters
{
string filelocation = argv[0];//save the file location into a string
string type;
size_t pos = filelocation.find_last_of("\\");//find the location of the last "\"
filelocation.erase(pos, (filelocation.size()-pos));//delete everything from the end of the string to the last "\"
string filename;
fstream forceclassfile; // declare a fstream object
menu();// load the function menu declared above
getline(cin, filename, '\n');
type = filename;
filename += ".txt"; //add .txt to the string
forceclassfile.open(filename.c_str(), ios::out);//open the file with the user input
if ( !forceclassfile.fail() )
{
for(int x = 1; x != 2001; x++)
{
forceclassfile << "admin forceclass "<< x << " " << type << endl;
}
cout << "File Succesfully Created! Press Enter!" << endl;
cout << "Your file can be found here : " << endl;
cout << filelocation << "\\" << filename << endl;//displays the file location
forceclassfile.close();
}
else
{
cout << "File Cannot Be Created" << endl;
cout << "Program Terminating!" << endl;
Sleep(3000);
return 2;
}
cout << "Copyright Richard Wilson 2005\n";
cout << "Contact Me at [email protected] if you discover any bugs...\n";
cout << "Press Enter\n";
cin.get();
return 0;
}
void menu(void)
{
cout << "This is the americas army admin forceclass file maker." << endl;
cout << "This will make a .txt file anywere you have this program." << endl;
cout << "I suggest you have this program on your desktop so the file" << endl;
cout << "will show up on your desktop." << endl;
cout << "If this file is in a folder the .txt file will appear in the" << endl;
cout << "folder this program is in." << endl;
cout << "Copyright Richard Wilson, made with the Dev-C++ Compiler Code" << endl;
cout << "supplied/created by Richard Wilson, all rights reserved" << endl << endl;
cout << "Press Enter when you are ready to continue." << endl;
cin.get();
cout << "What type of forceclass will it be?" << endl;
cout << "Exsamples :" << endl;
cout << "spr rpg m4a1 s24 sf" << endl;
cout << "Please enter the type: ";
}