Advertisement
aaaaaa123456789

JV's programming challenge, week 4, testing code 2

Dec 5th, 2012
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.57 KB | None | 0 0
  1. #include <stdio.h>
  2. #include "week4.c"
  3.  
  4. int main (int argc, char ** argv) {
  5.   if (argc < 2) {
  6.     printf("No size specified. Usage: %s <size>\n", *argv);
  7.     return 1;
  8.   }
  9.   unsigned short size;
  10.   if (!sscanf(argv[1], "%hu", &size)) {
  11.     printf("Invalid size specified.\n");
  12.     return 1;
  13.   }
  14.   unsigned short current;
  15.   unsigned short * result;
  16.   for (current = 5; current <= size; current ++) {
  17.     result = tour(current);
  18.     free(result); // not gonna use it, just see if there is one!
  19.     printf("% 4hu: %s\n", current, result ? "yes" : "no");
  20.   }
  21.   return 0;
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement