Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include "week4.c"
- int main (int argc, char ** argv) {
- if (argc < 2) {
- printf("No size specified. Usage: %s <size>\n", *argv);
- return 1;
- }
- unsigned short size;
- if (!sscanf(argv[1], "%hu", &size)) {
- printf("Invalid size specified.\n");
- return 1;
- }
- unsigned short * result = tour(size);
- if (!result)
- printf("No valid tour found.\n");
- else {
- unsigned short * current;
- printf("(%hu, %hu)", *result, result[1]);
- for (current = result + 2; (current - result) < (2 * size * size); current += 2)
- printf(", (%hu, %hu)", *current, current[1]);
- free(result);
- printf(".\n");
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement