Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

C++

Name: Anonymous 2009-01-31 20:39

I'm trying to write it so it accepts input from either arg's,or if executed, prompt the user for 2 inputs. Right now it simply skips over the if ( argc ... )

int main(int argc, char* argv[]) {
   
    char input[20];
    char output[20];

    ifstream in( input );
    ofstream out( output );   
    in.clear();
    out.clear();

    if( argc != 3) {
        cout << "Enter input file: ";
        cin >> input;
        ifstream in( input );
        cout << "Enter output file: ";
        cin >> output;
        ofstream out( output );
    }

    else if( argc == 3) {
        ifstream in( argv[1] );
        ofstream out( argv[2] );
    }

Name: Anonymous 2009-01-31 22:31

More like helping with homework wouldn't you say? Not like I posted write me this program kthnx.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List