Lab 11 – 2017

Slides: [ EST ] [ ENG ]
Kahoot Q&A: [ Link ]

Tasks

Practice Functions (2.5p + 0.5p)

Create a program, which will:

  • Ask for the size of the array (dimensions)
  • Create the array with specified dimensions
    • Initialize array with data (inputted by user)
    • Each element must be positive value
  • Find the largest element on each row without sorting
  • Find the sum of each rows
  • Find the row which has largest sum
  • Sort the array row by row (changing the original data)
  • Print the array after every step which modifies the array values
  • Freely write some function which will do something useful (0.5p)

Be sure to follow this rules :

  • NO GLOBAL VARIABLES!
  • NO FUNCTION DEFINITIONS INSIDE A FUNCTION!
  • Make the functions with following prototypes and comment functions
    • int input(const char *message);
    • int max_in_row(int row_length, int *array);
    • int max_in_row(int row_length, int array[row_length]);
    • int sum_row(int row_length, int *array);
    • int sum_row(int row_length, int array[row_length]);
    • void sort_row(int row_length, int *array);
    • void print(int rows, int cols, int array[rows][cols]);

One thought on “Lab 11 – 2017

Comments are closed.