Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Лабораторні, на англійській.doc
Скачиваний:
0
Добавлен:
01.05.2025
Размер:
604.67 Кб
Скачать

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

Calculate an average of 5 numbers (for positive values only)

Calculate a height (h) of triangular with known area (S) and base side (a)

Find an area of triangular with known sides (a, b, c) according to Heron's formula

Define if the value is inside the indicated range

Find a sum of all numbers in the indicated range

Find out if the number is odd or pair

Calculate an area of circle with known diameter

Convert inputted kilograms into pounds

Convert your height to feet and inches while inputting only in inches

Calculate body mass index

Calculate number of seconds if user inputs time in hours, minutes and seconds separately

Output number of days if user inputs period in years, months and days

Calculate number of hours, minutes and seconds if user inputs time in seconds

Report the miles per gallon your car has gotten if you know how many miles you have driven and how many gallons of gasoline you have used

Write a program that asks you to enter an automobile gasoline consumption figure in the European style (liters per 100 kilometers) and converts to the U.S. style of miles per gallon

Develop currency convertor between Ukrainian Hryvna, US Dollar and Euro

Create a convertor between Fahrenheit and Celsius temperature

Calculate the total cost of pens and copybooks required by a pupil if you know prices and quantities

3. Report Structure

  • Title page (Annex A)

  • Task overview

  • Algorithm’s flowchart

  • Program code

  • Program running screenshots

  • Conclusions

4. Control Exercises

4.1. Write expressions for the following:

  • To test if a number n is even.

  • To test if a character c is a digit.

  • To test if a character c is a letter.

  • To do the test: n is odd and positive or n is even and negative.

  • To give the absolute value of a number n.

  • To give the number of characters in a null-terminated string literal s.

4.2. Add extra brackets to the following expressions to explicitly show the order in which the operators are evaluated:

(n <= p + q && n >= p - q || n == 0)

(++n * q-- / ++p - q)

(n | p & q ^ p << 2 + q)

(p < q ? n < p ? q * n - 2 : q / n + 1 : q - n)

4.3. What will be the value of each of the following variables after its initialization?

double d = 2 * int(3.14);

long k = 3.14 - 3;

char c = 'a' + 2;

char c = 'p' + 'A' - 'a';