wassilina
05.12.2021 21:51

');
sound(zvuk); delay(del); nosound;
readln; close(g);
halt;
End;

Procedure DAi;
Begin
writeln;
textcolor(14);
writeln(' Этап пройден успешно.');
textcolor(15);

readln; clrscr;
End;

Procedure ident;
Begin

writeln(' 4 этап- Идентификация...');
writeln('> Анализ переменных и ключевых слов:');

{изменяем регистр всех букв } sb1:=sb;
for i:=1 to dlina do sb[i]:=upcase(sb[i]); writeln(sb); s2:=sb;

{создаем массив строк- каждая из которых 1 слово}
i:=0; j:=1;
While i ' ') and (((sb1[i] in bukva) or (sb1[i] in BUKVA2)) or (sb1[i] in c)) then
ms[j]:=ms[j]+upcase(sb1[i])
else inc(j)
end;

{по очереди проверяем каждое ключевое слово на вхождение в строку Sb}
writeln(''); textcolor(11);
writeln('Ключевые слова:'); textcolor(15);
i:=1; j:=1;
while j<> length(sb) do begin

if ((ms[j]='CONST') or
(ms[j]='TRUE' ) or
(ms[j]='FALSE') or
(ms[j]='BEGIN') or
(ms[j]='END' ) or
(ms[j]='ARRAY') or
(ms[j]='SET' ) or
(ms[j]='OF') or
(ms[j]='DO') or
(ms[j]='CASE') or
(ms[j]='TO') or
(ms[j]='THEN') or
(ms[j]='WHILE') or
(ms[j]='IF') or
(ms[j]='FUNCTION') or
(ms[j]='PROCEDURE') or
(ms[j]='AND') or
(ms[j]='OR') or
( ms[j]='TYPE') or
( ms[j]='REPEAT') or
(ms[j]='VAR') or
( ms[j]='ELSE') or
( ms[j]='UNTIL')) and
(pos(ms[j],sb)>0)
then begin if length(ms[i])<>0 then begin

mk[i]:=ms[j];
writeln(ms[j]);
delete(sb,pos(mk[i],sb),length(mk[i]));
inc(kolk); end;
end;
inc(i); inc(j);
end;

{по очереди проверяем каждый тип данных на вхождение в строку Sb}
writeln(''); textcolor(11);
writeln('Типы данных:'); textcolor(15);

{создаем массив типов данных}
i:=1; j:=1;
while j<> length(sb) do begin
if ((ms[j]='INTEGER') or
(ms[j]='LONGINT') or
(ms[j]='REAL') or
(ms[j]='BYTE') or
(ms[j]='WORD') or
(ms[j]='STRING') or
(ms[j]='SHORTINT') or
(ms[j]='SINGLE') or
(ms[j]='DOUBLE') or
(ms[j]='EXTENDED') or
(ms[j]='CHAR')) and
(pos(ms[j],sb)>0)
then begin if length(ms[i])<>0 then begin
mt[i]:=ms[j];
writeln(ms[j]);
delete(sb,pos(mt[i],sb),length(mt[i]));
inc(kolt);
end; end;
inc(i);
inc(j);
end;

{отсеиваем Не ключевые слова}
writeln; textcolor(11);
writeln(''); writeln('Переменные:');
textcolor(15);
{создаём массив переменных}
j:=1; i:=1;
while j<> length(sb) do begin
if ((ms[j]<>'CONST') and
(ms[j]<>'TRUE' ) and
(ms[j]<>'FALSE') and
(ms[j]<>'BEGIN') and
(ms[j]<>'END' ) and
(ms[j]<>'ARRAY') and
(ms[j]<>'SET' ) and
(ms[j]<>'OF') and
(ms[j]<>'DO') and
( ms[j]<>'CASE') and
(ms[j]<>'TO') and
(ms[j]<>'THEN') and
(ms[j]<>'WHILE') and
(ms[j]<>'IF') and
(ms[j]<>'FUNCTION') and
(ms[j]<>'PROCEDURE') and
(ms[j]<>'AND') and
( ms[j]<>'OR') and
( ms[j]<>'TYPE') and
( ms[j]<>'REPEAT') and
(ms[j]<>'VAR') and
( ms[j]<>'ELSE') and
( ms[j]<>'UNTIL') and
(ms[j]<>'INTEGER') and
(ms[j]<>'LONGINT') and
(ms[j]<>'REAL') and
(ms[j]<>'BYTE') and
(ms[j]<>'WORD') and
(ms[j]<>'SHORTINT') and
(ms[j]<>'SINGLE') and
(ms[j]<>'DOUBLE') and
(ms[j]<>'EXTENDED') and
(ms[j]<>'CHAR')) and
(pos(ms[j],sb)>0)

then begin
if length(ms[j])<>0 then begin
mp[i]:=ms[j];
writeln(mp[i]);
delete(sb,pos(mp[i],sb),length(mp[i]));
inc(kolp); end;
end;
inc(i);
inc(j);
end;
writeln('');
DAi;
End;

Нажмите на рекламу ниже и сразу увидите ответ
Популярные вопросы:
Ответ:
Ученик132312
22.09.2022 14:27

#include <iostream>

int main() {

const int SIZE = 10;

bool isSence = false;

int sum = 0;

int count = 0;

int arr[SIZE];

for (int i = 0; i < SIZE; i++)

{

 arr[i] = rand() % 20 - 10; // "рандомно" заполняем массив от -10 до 10

 std::cout << arr[i] << "\t"; // выводим массив в консоль

 if (arr[i] >= 0)

  isSence = true;

}

for (int i = 0; i < SIZE; i++)

{

 if ((isSence) && (arr[i] > 0))

  sum += arr[i]; //sum = sum + arr[i];

  count++;

}

if (isSence)

 std::cout << "\nсреднее арифметическое положительных чисел = " << double(sum) / count << std::endl; // явное приведение типов

else

 std::cout << "\nВ массиве нету положительных чисел или нету нулей и/или отрицательных чисел" << std::endl;

return 0;

}

0,0(0 оценок)
Ответ:
robiya86
22.07.2020 13:22
Только программа, блок-схему не знаю
#include <iostream>
#include <iomanip>
#include <vector>
#include <ctime>
int main()
{
    using namespace std;

    const int n = 5;
    int A[n][n];
    int D[n][n];
    vector<int> B(n);
    vector<int> C(n);
    vector<int> S(n);   //результирующий вектор

    //как-нибудь заполняем исходные матрицы и вектора
    srand(time(0));
    for (int i = 0; i < n; ++i)
    {
        for (int j = 0; j < n; ++j)
        {
            A[i][j] = rand() % (n * n) - n * n / 2;
            D[i][j] = rand() % (n * n) - n * 2;
        }
        B[i] = rand() % (n * n) - n;
        C[i] = rand() % (n * n) - n * n + n;
    }

    //выведем исходные данные на экран
    cout << "matrix A:\n";
    for (int i = 0; i < n; ++i)
    {
        for (int j = 0; j < n; ++j)
            cout << setw(5) << A[i][j];
        cout << endl;
    }

    cout << "\nmatrix D:\n";
    for (int i = 0; i < n; ++i)
    {
        for (int j = 0; j < n; ++j)
            cout << setw(5) << D[i][j];
        cout << endl;
    }

    cout << "\nvector B:\n";
    for (int i = 0; i < n; ++i)
        cout << setw(5) << B[i] << endl;

    cout << "\nvector C:\n";
    for (int i = 0; i < n; ++i)
        cout << setw(5) << C[i] << endl;

    //вычислим требуемое
    for (int i = 0; i < n; ++i)
    {
        S[i] = 0;
        for (int j = 0; j < n; ++j)
            S[i] += D[i][j] * C[j];
        S[i] += 3 * B[i];
    }

    //выведем результат на экран
    cout << "\nvector S = D * C + 3 * B:\n";
    for (int i = 0; i < n; ++i)
        cout << setw(5) << S[i] << endl;

    return 0;
}
0,0(0 оценок)
Полный доступ
Позволит учиться лучше и быстрее. Неограниченный доступ к базе и ответам от экспертов и ai-bota Оформи подписку
logo
Начни делиться знаниями
Вход Регистрация
Что ты хочешь узнать?
Спроси ai-бота