Автор работы: Пользователь скрыл имя, 12 Февраля 2013 в 03:35, лабораторная работа
The aim of the work: Drafting of the simplest of programs, realizing the conduct of the computing operations by the formulas that define the algorithm of linear structures.
Linear algorithms is a sequence of blocks, each of which has one input and one output and is performed in the program only once.
Laboratory work №
3 Programming algorithms of the linear structure
The aim of the work: Drafting of the simplest of programs, realizing the conduct of the
computing operations by the formulas that define the algorithm of linear
structures.
Linear algorithms is a sequence of blocks, each of which has one input
and one output and is performed in the program only once.
Pic. 1. Algorithm of linear structures
The task. Calculate the area of a triangle of three known sides a, b, c, using
theorem Gerona
The method for performing the work
1. The program has a linear structure in accordance with the algorithm
in Fig. 1.
S1 - block of input data a, b, c.
S2 - blocks calculation полупериметра
triangle p and S. square
S3 - block print the results: the area of
S.
1. Enter the program of the decision of this:
2. Compile the program and fix possible errors. Then start the program
at the expense of
3. Pass the test the calculation to verify proper operation of the program.
Enter the values of the parties: (a=1, b=1, c=1. Should get the result
S=0.433013.)
4. Run a series of calculations for various values of the sides of the
triangle.
Tasks for independent work
To compile a program in the C language for finding the value of an
expression.
The constants A, B, C are input from the keyboard
Option 1
if A=4, B=2, C=5 answer: -0.867393.
Option 2
If A=7, B=2, C=1 answer: -1.267885.
Option 3
If A=7, B=2, C=1 answer: -1.267885.
Option 4
If A=3, B=7, C=2 answer: 0.116161.
Option 5
If A=3, B=2, C=1 answer: 16718.692
The report should contain:
1) Texts of carried out programs.
2) Results of calculations.
Информация о работе Programming algorithms of the linear structure