 Главная | Случайная
Обратная связь

ТОР 5 статей:

Методические подходы к анализу финансового состояния предприятия

Проблема периодизации русской литературы ХХ века. Краткая характеристика второй половины ХХ века

Ценовые и неценовые факторы

Характеристика шлифовальных кругов и ее маркировка

Служебные части речи. Предлог. Союз. Частицы

КАТЕГОРИИ:

# Task 2. Write a program to calculate the area and perimeter of the triangle by the formula of Heron.

INPUT «Enter the side of the triangle; A, B, C

P = (a + b + c) / 2

S = SQR (p * (p - a) * (p - d) * (p - c))

PRINT «area of a triangle is equal to"; S

Tasks for the independent exercise

1. Within a month the seller delivers to the house 4 liters of milk per day. In March, the milk was worth X rubles. per liter. On the first of April the price of milk has increased to [x + a] rubles per liter. How much you have to pay the seller for all milk delivered at the end of April? Number of purchased milk remained the same.

2. Write a program to determine the date when the store buying goods: gloves A cost rub, rub the portfolio value of B, a tie worth C rubles... The initial amount allocated for the purchase of D RUB. In the case of lack of money renting turn negative.

3. The firm has three stores. Known income of each store of the five days. Organize information input in accordance with the table and determine the total revenue for each store; income for 4 days; determine the income of all stores for each day.

4. Starting a workout, skier on the first day ran a 10 km. Every day he increased the mileage by 10% from the previous day's run. Determine: a skier running for the second, third ... tenth day of training; the total path of the skier in the last 7 days of training.

Control questions:

1. IO procedures.

2. As written format variable declarations?

Practical work 9.Drawing up a program with the conditional operator

Objective: To acquire the skills of building programs using conditional on QBasic

Brief theoretical information:

IF ... THEN ... ELSE

IF ... THEN ... ELSE - Managing operator performing conditional branching operations, based on an evaluation of a logical expression.

 Syntax Example IF логическое_ Expression_1 THEN [operator1] [ELSE IF THEN logicheskoe_vyrazhenie_2 Operatory_2] [ELSE [operators n]] END IF IF X> 0 THEN PRINT "X - positive" ELSEIF X <0 THEN PRINT "X - negative" ELSE PRINT "X - zero" END IF

SELECT ... END SELECT

SELECT ... END SELECT - control statement Thap performs DEW of-Severan statement depending blochks he Tkhe shaft of-an expression.

 Syntax Example SELECT CASE expression of the choice [of CASE spisok_vyrazheniy_1] [operators v1] [CASE spisok_vyrazheniy_2] [operators v2] ... ... [CASE ELSE [operatory_n]] END SELECT INPUT TestValue SELECT CASE TestValue CASE 1, 3, 5, 7, 9 PRINT « odd » CASE 2, 4 ,6, 8 PRINT « odd » CASE IS <1 PRINT “Very little” CASE IS >9 PRINT “very big” CASE ELSE PRINT “Not an integer value” END SELECT

• choice of expression - any numeric and symbolic expression

• a list of expressions - one or more of the expressions of the same type as the expression of choice. CASE keyword must be preceded by a block of statements;

Assignment for practical work

1.  Write a program that determines whether a point belongs to the specified coordinates (x, y) the shaded area on the attached.   Не нашли, что искали? Воспользуйтесь поиском:

vikidalka.ru - 2015-2019 год. Все права принадлежат их авторам! Нарушение авторских прав | Нарушение персональных данных