// A heavily modified version of slide.c for Assignment 1

// This is starter code for the Tourist Program

// Marc Chee (cs1511@cse.unsw.edu.au)
// June 2019 - March 2021
//

#include <stdio.h>

// The dimensions of the map
#define N_ROWS 10
#define N_COLS 10

// Helper Function: Print out the map as a 2D grid
void print_map(int map[N_ROWS][N_COLS], int posR, int posC);


int main(void) {

    return 0;
}


// Prints the map, by printing the integer value stored in
// each element of the 2-dimensional map array.
// Prints a T instead at the position posR, posC
void print_map(int map[N_ROWS][N_COLS], int posR, int posC) {
    int row = 0;
    while (row < N_ROWS) {
        int col = 0;
        while (col < N_COLS) {
            if(posR == row && posC = col) {
                printf("T ");
            } else {
                printf("%d ", map[row][col]);
            }            
            col++;
        }
        row++;
        printf("\n");
    }
}

Resource created Wednesday 27 January 2021, 01:16:16 PM, last modified Monday 08 March 2021, 04:17:17 PM.

file: tourist.c


Back to top

COMP1511 21T1 (Programming Fundamentals) is powered by WebCMS3
CRICOS Provider No. 00098G