Share Pastebin
Guest
Public paste!

Untitled

By: a guest | Mar 22nd, 2010 | Syntax: C | Size: 0.83 KB | Hits: 55 | Expires: Never
This paste has a previous version, view the difference. Copy text to clipboard
  1. #include <stdio.h>
  2. #include <math.h>
  3.  
  4. /*print a clear board to start the game*/
  5.  
  6. main(int argc, const char* argv[]) {
  7.         /*Argument 1 is rules. Read this in in text mode.*/
  8.         FILE *rules;
  9.         int rows,cols;
  10.         if(argc >= 2){
  11.                 rules = fopen(argv[1], "r");
  12.                 if (rules == NULL)
  13.                 {
  14.                         fprintf(stderr, "There was an error opening the rules file.");
  15.                         return 1;
  16.                 }
  17.         }  
  18.         while(!feof(rules)) {
  19.                 fscanf(rules, "%d %d", &rows,&cols);
  20.                 printf("%d %d", rows,cols);
  21.         }  
  22.         /*Create our game board*/
  23.         int array[rows][cols];
  24.    
  25.  
  26.         fprintf(stderr,"***************************\n");
  27.         fprintf(stderr,"         NAVAL             \n");
  28.  
  29. }
  30. ~