Introduction to Programming

Public Resources

 

No login is required.
If provided, read carefully additional texts that can contain some helpful information on the origins of the files, licence agreements, etc.

 

Click HERE to download en empty project.

Lesson 1

  • subject conditions
  • recommended IDE (Visual Studio Code)
  • template project in C++

LESSON 2

Prerequisites

  • variables, basic data types
  • numeric, logic, and bitwise operators
  • basic loops
  • standard input/output with defined format
  • functions

 

Topics and Tasks

  • practice the above mentioned items
  • read some numeric data from the standard input
  • write a variable of unsigned int data type to the standard output in a binary form
  • create a new method that will print a given number in its binary form
  • ask the user for a number, read it and print it in the normal, binary and hexadecimal form

 

One-minute code

  • Four easy examples that demonstrate how to repeatedly prompt the user to enter a number. Try to find the differences. -> DOWNLOAD

 

LESSON 3

Prerequisites

  • functions/methods ... basic notations, return values, etc.
  • random numbers
  • arrays

 

Topics and Tasks

  • make a static declaration of an array of ten elements and initialize such array to following values {5, 7, 8, 6, 20, 100, 15, 13, 4, 5}
  • create a function that fills a given array with random numbers from interval <0,1>
  • create a function that returns the largest number in a given array and index of this number
  • create an array of 1M elements
  • create a matrix M[m x n]. Fill the matrix with integer numbers such that the M[i, j] = i + j, where i∈<0, m-1>, j∈<0,n-1>, m=100, and n=100.
  • create a matrix M[1000x1000]. Fill the matrix with random numbers from interval <0,255>. This matrix represents a grayscale image. Create a histogram for this image.

Lesson 4

Prerequisites

  • functions
  • standard math library

 

Topics and Tasks

  • a short recap of the previous tasks
  • write a function f(x) that returns a single value for every x from the interval <-1000,1000>, if (x mod 3 == 0). The function is given by the following formula:

Math formula

  • think about the optimization. Do you really need the division and modulo? What about the absolute value?
  • try to modify the function such that the user can set the interval (upper and lower bound).