PROGRAMMING LABYRINTH Array An array is a collection

PROGRAMMING LABYRINTH

Array • An array is a collection of data of the same type • Array dimension is located in square brackets on declaration : int new_array[5];

Two-dimensional array • Two-dimensional array can be viewed as an array whose elements are arrays • To determine the dimensions we can use two square brackets int new_array [10]; • A two-dimensional array can be simply displayed as a table • The number in the first bracket indicates the maximum number of rows. In the second bracket number indicates the max. number of columns

` • Each data we can access using the index brackets. • In the C programming language indexing starts from zero

Two-dimensional text


Labyrinth Silver coin from Knossos representing the labyrinth, 400 BC.

Ulam spiral We can notice that prime numbers have special positions

Ulam spiral Prime numbers are building all diagonal lines in Figure and they also follow the Euler polynomial f(x)=x 2 -x+41

Timer #include <stdio. h> #include <unistd. h> printf(“cekaj …"); sleep(2000); printf(“vreme je isteklo");

Pseudorandom values #include <time. h> #include <stdlib. h> srand(time(NULL)); int r = rand();

Console program - random path

Console program - random path

Console program - a labyrinth

Console program - a labyrinth

Creating a graphic program in C# • Graphics objects are created by calling the Create. Graphics() method • We can draw basic geometric elements using folowing methods : draw. Line(), draw. Ellipse(), draw. Rectangle(), …

Graphic program- a labyrinth

Graphic program
- Slides: 18