0

hello. I am writing a program that will solve a type of min. spanning tree problem. i have 2 different algorithms that I've gotten working in two separate .cpp files i've named kruskels.cpp and prims.cpp.

my question is this:

each file takes the following command line to run it . time ./FILENAME INPUTFILE FACTOR

i would like to make a program that, depending on what inputfile is entered, will run either kruskels.cpp or prims.cpp. how can i do this?

this program must pass those command line arguments to kruskels or prims. each file (kruskels.cpp and prims.cpp) are designed to be run using those command line arugments (so they take in INPUTFILE and FACTOR as variables to do file io).

2
Contributors
3
Replies
4
Views
7 Years
Discussion Span
Last Post by Salem
0

Rename each main to be

int kruskels_main( int argc, char *argv[] );
int prims_main( int argc, char *argv[] );

The driver.cpp then becomes (with a bit of fluff for choices)

int main ( int argc, char *argv[] ) {
    return  kruskels_main( argc, argv );
}
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.