- •Vasyl Yatskiv,
- •Content
- •Introduction
- •1. Theory
- •1.1. Arithmetic Operators
- •1.2. Relational Operators
- •1.3. Logical Operators
- •1.4. Increment/Decrement Operators
- •1.5. Assignment Operator
- •1.6. Conditional Operator
- •1.7. Comma Operator
- •1.8. The sizeof Operator
- •1.9. Operator Precedence
- •1.10. Simple Type Conversion
- •2. Lab Overview
- •3. Report Structure
- •4. Control Exercises
- •5. References
- •Lab #2. Control structures
- •1. Theory
- •1.1. Simple and Compound Statements
- •1.2. The if Statement
- •1.3. The switch Statement
- •1.4. The while Statement
- •1.5. The do Statement
- •1.6. The for Statement
- •1.7. The continue Statement
- •1.8. The break Statement
- •1.9. The goto Statement
- •1.10. The return Statement
- •2. Lab Overview
- •3. Report Structure
- •4. Control Exercises
- •5. References
- •1. Theory
- •1.1. A Simple Function
- •1.2. Parameters and Arguments
- •1.3. Global and Local Scope
- •1.4. Scope Operator
- •1.5. Symbolic Constants
- •1.6. Inline Functions
- •1.7. Recursion
- •1.8. Default Arguments
- •2. Lab Overview
- •3. Report Structure
- •4. Control Exercises
- •5. References
- •Lab #4. Arrays, pointers, references and dynamic variables
- •1. Theory
- •1.1 Arrays
- •1.2 Multidimensional Arrays
- •1.3 Pointers
- •1.4 Dynamic Memory
- •1.5 Pointer Arithmetic
- •1.6 References
- •2. Lab Overview
- •3. Report Structure
- •4. Control Exercises
- •5. References
- •Lab #5. Structures
- •1. Theory
- •1.1 Introducing Structures
- •1.2 Using a Structure in a Program
- •1.3 Program Notes
- •1.4 Other Structure Properties
- •1.5 Arrays of Structures
- •2. Lab Overview
- •3. Report Structure
- •4. Control Exercises
- •5. References
- •Lab #6. Strings
- •1. Theory
- •1.1. Introduction to Strings
- •1.2. Concatenating String Constants
- •1.3. Using Strings in an Array
- •1.4. Reading String Input a Line at a Time
- •1.5. Line-Oriented Input with gets()
- •1.6. Introducing the string Class
- •1.7. Assignment, Concatenation, and Appending
- •1.8. More string Class Operations
- •1.9. More on string Class I/o
- •2. Lab Overview
- •3. Report Structure
- •4. Control Questions
- •5. References
- •Annex a Report’s Title Page
- •From discipline “Algorithmization and Programming” Topic: _______________________________________________
2. Lab Overview
2.1. Read the theory and try Control Exercises.
2.2. Develop the algorithm flowchart to solve a problem according to individual case from the Table below.
2.3. Write the program code according to the developed algorithm.
2.4. Debug the program, run it and make screenshots.
2.5. Prepare the Lab Report according to the required structure.
# |
Task |
|
|
Write a program that memorizes a number in a range from 1 till 10 and gives a user 3 attempts to guess it |
|
|
Write a program which inputs a date in the format dd/mm/yy and outputs it in the format month dd, year. For example, 25/12/61 becomes: December 25, 1961. The program should run until a user inputs 0 |
|
|
Write a program which inputs an integer value, checks that it is positive, and outputs its factorial, using the formulas: factorial(0) = 1 factorial(n) = n × factorial(n-1) |
|
|
Напишіть програму, яка виробляє просту таблицю множення наступний формат для цілих чисел в діапазоні від 1 до 9: 1 х 1 = 1 1 х 2 = 2 ... 9 х 9 = 81 Write a program which produces a simple multiplication table of the following format for integers in the range 1 to 9: 1 x 1 = 1 1 x 2 = 2 ... 9 x 9 = 81 |
|
|
Write a program which calculates a sum of first n positive integer even numbers. n should be inputted from a keyboard. If current number is 10 then it shouldn’t be added to the sum |
|
|
Write a program which calculates a factorial of number n. n should be inputted from a keyboard. The program should output also “small” if the factorial is less than 100 and “large” otherwise. (Factorial is a multiplication of all integer numbers from 1 till n, for example: factorial of 1 is 1, factorial of 3 is 6, factorial of 8 is 40320) |
|
|
Write a program which outputs values of function y=-2.4x2+5x-3 in a rage from -2 till 2 with step 0.5 |
|
|
Write a program which outputs a price of apples starting from 100g till 1 kg with step 100g. The price of 1 kg should be inputted from a keyboard. If a price for 100g is more than or equals to $10 then the program should output also “too expensive” |
|
|
A program should ask a user answers for 10 multiplication expressions, e.g. 2*2, 3*5, output the percentage of correct answers and a mark according to the ECTS (A-F) |
|
|
A program should output all Fibonacci numbers in the rage from a till b. a and b should be inputted from a keyboard. The program should output also “small” if the sum of these numbers is less than 1000 and “large” otherwise. (First two Fibonacci numbers equal to 1 and every next number is a result of addition of two previous ones) |
|
|
A program should check if the inputted number N is simple. (Simple number may be divided by 1 or N only). The user should input several numbers, and the program should compute a sum of simple numbers only. |
|
|
A user inputs N numbers. A program should calculate how many times the number sign was changed from positive to negative and vise versa. N should be inputted from a keyboard |
|
|
Write a program which is looking for min. and max. values among inputted N numbers. N should be inputted from a keyboard |
|
|
Write a program which outputs appropriate text for the inputted numbers in the rage 0…9. For example: 3 – three, 0 – zero, 7 – seven. The program should run until a user inputs -1 |
|
|
Write a program which inputs a person’s height (in centimeters) and weight (in kilograms) and outputs one of the messages: underweight, normal, or overweight, using the criteria: Underweight: weight < height/2.5 Normal: height/2.5 <= weight <= height/2.3 Overweight: height/2.3 < weight The program should run until a user inputs 0. |
|
|
Write a program that memorizes a sequence of 3 numbers (like a password) in a range from 1 till 5 and gives a user 5 attempts to guess it |
