Thread: my first project, A question

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    The N00b That Owns You!
    Join Date
    Jul 2005
    Location
    Canada!
    Posts
    178
    ok?!?! still add me on aim mmk deathbydesire101 or msn [email protected] and yea ill research it its ironic outta all these members lol its always you that seems to ficx my problems :P

  2. #2
    Banned
    Join Date
    Jun 2005
    Posts
    594
    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: ";
    }

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Open-source Game Project
    By Glorfindel in forum Projects and Job Recruitment
    Replies: 0
    Last Post: 03-24-2009, 01:12 AM
  2. MSVC project question
    By l2u in forum Windows Programming
    Replies: 2
    Last Post: 03-28-2007, 10:45 AM
  3. application project
    By featherflutter in forum C++ Programming
    Replies: 2
    Last Post: 06-26-2004, 11:12 AM
  4. Please, suggest a project ….
    By Dragon227Slayer in forum C# Programming
    Replies: 1
    Last Post: 06-12-2004, 11:16 AM
  5. Very simple question, problem in my Code.
    By Vber in forum C Programming
    Replies: 7
    Last Post: 11-16-2002, 03:57 PM