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

Pages: 1-

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 20:43

}

else if( argc == 3) {

what the christ

Name: Anonymous 2009-01-31 20:48

Wat :3

Name: Anonymous 2009-01-31 20:54

>>2
Every time I initialize or change a variable I use an assertion to confirm that it worked.

Name: Anonymous 2009-01-31 21:21

Learn how to code.

Name: Anonymous 2009-01-31 21:32

whats an arg?

Name: Anonymous 2009-01-31 21:36

A noise a pirate makes, or an argument.
Like foo.exe [input] [output]

Name: Anonymous 2009-01-31 21:40

>>7
I don't know which pirates you've been fornicating with, but they don't say ``arg.''

Name: Anonymous 2009-01-31 21:45

I bet we can't help the OP.

Name: Anonymous 2009-01-31 21:46

I bet we can't help the OP.

Name: Anonymous 2009-01-31 22:07

>>10
Of course we can't, it's against the rules.

Name: Anonymous 2009-01-31 22:21

I bet we can use unsubtle psychological tricks to persuade people to do our homework for us.

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.

Name: Anonymous 2009-01-31 22:33

You didn't even ask a question.

Name: Anonymous 2009-01-31 22:39

>>13
Try reading SICP.

Name: Anonymous 2009-03-06 13:30


A symmetric little polynomial you are I   know stores it.

Name: Anonymous 2010-12-24 5:21

Name: Anonymous 2011-02-04 12:03


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