gap.c
/***** copy and read the parameters ******************************************/
/***** Feel free to modify this subroutine. **********************************/
copy and read the parameters
Feel free to modify this subroutine.
copy and read the parameters Feel free to modify this subroutine .
void copy_parameters(int argc, char *argv[], Param *param)
{
  int i;
  param->timelim = TIMELIM;
  param->givesol = GIVESOL;
  if(argc>0 && (argc % 2)==0){
    printf("USAGE: ./gap [param_name, param_value] [name, value]...\n");
    exit(EXIT_FAILURE);}
  else{
    for(i=1; i<argc; i+=2){
      if(strcmp(argv[i],"timelim")==0) param->timelim = atoi(argv[i+1]);
      if(strcmp(argv[i],"givesol")==0) param->givesol = atoi(argv[i+1]);
    }
  }
}
void copy_parameters ( int argc , char * argv [ ] , Param * param ) { int i ; param -> timelim = TIMELIM ; param -> givesol = GIVESOL ; if ( argc > 0 && ( argc % 2 ) == 0 ) { printf ( " \n " ) ; exit ( EXIT_FAILURE ) ; } else { for ( i = 1 ; i < argc ; i += 2 ) { if ( strcmp ( argv [ i ] , " " ) == 0 ) param -> timelim = atoi ( argv [ i + 1 ] ) ; if ( strcmp ( argv [ i ] , " " ) == 0 ) param -> givesol = atoi ( argv [ i + 1 ] ) ; } } }
copy and read the parameters
Feel free to modify this subroutine.
copy and read the parameters Feel free to modify this subroutine .
/**** copy the parameters ****/ /**** read the parameters ****/