#include #include #include int main(int argc, char **argv) { int objects, weight_start, weight_end, profit_start, profit_end, capacity; if (argc < 7) { printf("Usage: %s [objects] [weight range start] [weight range end] [profit range start] [profit range end] [capacity]\n", argv[0]); exit(-1); } else { objects = atoi(argv[1]); weight_start = atoi(argv[2]); weight_end = atoi(argv[3]); profit_start = atoi(argv[4]); profit_end = atoi(argv[5]); capacity = atoi(argv[6]); } printf("%d %d\n", objects, capacity); int i = 0; srandom(time(NULL)); for (i = 0; i < objects; i++) { int weight = random()%(weight_end-weight_start+1) + weight_start; int profit = random()%(profit_end-profit_start+1) + profit_start; printf("%d %d\n", weight, profit); } return 0; }