repkinvasya
06.06.2022 03:08

Это код калькулятора(Паскаль),нужно,чтобы он был написан по столбикам,а не по строчкам,как сейчас.
program Calculator;
uses Functions,GrMouse,GrButton,Graph,GrOutPut,dos,crt;: string=' 7 8 9/< - x^y'+
' 4 5 6 * sin cos'+
' 1 2 3 - tg ktg'+
' 0 с. + = ы'+
' P R O E K T';
{$F+}: array [1.35] of TGrButton;,QuitButton: TGrButton;,SecondEdit: TGrButton;: TMouseStatus;: boolean;GetCaption (i: byte): string;,TempPos,Count: byte;: =0;: =0;x: =1 to Length (Captions) doCaptions [x] =' ' then inc (count);Count=i-2 then TempPos: =x;Count=i-1 then GetCaption: =copy (Captions,TempPos+2,x-TempPos-1);;;ChangeSysOfCount (SysOfCount: TSysCountStr);: string;SysOfCount [1] of
'D': begin;;SysOfCount [1] of
'D': begin SysCount: =DEC; DisButtons: =DECindexes; end;;(FParam);(SParam);(false);(SParam);(true);(FParam);;SetGroupEnabled (SysOfCount: TSysCountStr);: =ALLnumbers;i: =2 to 35 doi in DisButtons thenButtons [i] donot Enabled then(true);(SysOFCount);i: =2 to 35 doi in DisButtons then[i]. SetEnabled (False);: ='';;DrawingSquareOfButt (MaxTopInc,LeftOffs,TopOffs,BStartInd,BCount: word);: =0;j<=MaxTopInc doi: =BStartInd-1 to BStartInd+BCount-2 do[j+i+1]. Left: =i*50+LeftOffs;[j+i+1]. Top: =j*7+TopOffs;[j+i+1]. Draw;;(j,7);;;Action;: =true;;SetRadioClick (var ActButt,DisAct1,DisAct2: TGrButton);ActButt. FillColor=ActButt. FillColor then. FillColor: =ActButt. PressedColor;. FillColor: =1;. FillColor: =1;. Fill (ActButt. PressedColor);. Fill (DisAct1. FillColor);. FIll (DisAct2. FillColor);;;SetDECsys;(Buttons [8],Buttons [1],Buttons [15]);('DEC');;FstAction;(FirstEdit. FillColor=1) then. FillColor: =4;. FillColor: =1;. Draw;. Draw;(true);: =false;;;SndAction;(SecondEdit. FillColor=1) then. FillColor: =1;. FillColor: =4;. Draw;. Draw;(false). Init;. Init;. Init;. Init;i: =1 to 35 doButtons [i] do;: =GetCaption (i+1);;QuitButton do: =140;: =GetMaxY-50;: =20;: =370;: ='Quit';;;CEButton do: =GetMaxX-220;: =80;: =30;: =85;: ='CE';;;FirstEdit do: =GetMaxX-55;: =120;: ='Fst';: =4;;;SecondEdit do: =GetMaxX-55;: =170;: ='Snd';;;(30,140,1200,1,1);(30,170,120,2,6);(5,5,GetMaxX-5,GetMaxY-5);(OutXs,OutYs,OutXf,OutYf);
{/*End of drawing*/};;;[1]. PressedColor: =8;[8]. PressedColor: =8;[15]. PressedColor: =8;('DEC');(Buttons [8],Buttons [1],Buttons [15]);[8]. Action: =SetDECsys;[6]. Action: =BackSpaceSymbol;[24]. Action: =SetPlusMines;[27]. Action: =GetResult;
{}not Quit doi: =1 to 35 doButtons [i] doonClick (Action,MouseStatus) then(Length (Caption) =1) then(Caption [1] in SysCount) then(Caption);: =false;;(Caption [1]);Caption [1] ='с' then Calculated: =false;;: =0;KeyPressed then: =Ord (readkey);Key of
.57,46,97.103:UpCase (Char (Key)) in SysCount then(UpCase (Char (Key)));: =false;;
: begin;: =false;;
: SetEnterMode ('*'); {*}
: SetEnterMode ('+'); {+}
: SetEnterMode ('-'); {-}
: SetEnterMode ('/'); {/}
: exit. onClick (Action,MouseStatus);. OnClick (CEClick,MouseStatus);FirstEdit. OnClick (FstAction,MouseStatus) or (FActive) then FstAction;SecondEdit. OnClick (SndAction,MouseStatus) or (SActive) then SndAction;;;.

Нажмите на рекламу ниже и сразу увидите ответ
↓
Популярные вопросы:
Ответ:
Ученик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-бота