alexc123
21.08.2022 13:19

По фрагменту программы составить трассировочную таблицу const n = 5;
a: array [1..n] of integer = (5, -8, 15, 15, -8);
var i, b, c: integer;
begin
b := a[1];
c := 1;
for i := 2 to n do if a[i] <= b then
begin
b := a[i];
c := i
end;
writeln(c)
end.​

Нажмите на рекламу ниже и сразу увидите ответ
Популярные вопросы:
Ответ:
даша33100
21.07.2020 00:17

написал на с++

Объяснение:

#include <iostream>

#include <windows.h>//для русской раскладки

using namespace std;

int main()

{

SetConsoleCP(1251);//подключаем русскую раскладку

SetConsoleOutputCP(1251);

float a[3][4]; //двумерный массив

cout << "Введите элементы массива:" << endl;

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

{

 for (int j = 0; j < 4; j++)

 {

  cout << "a[" << i + 1 << "][" << j + 1 << "]= ";

  cin >> a[i][j];

 }

}

cout << "Введенная матрица до изменения:" << endl; //вывод матрицы B

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

{

 for (int j = 0; j < 4; j++)

 {

  cout.width(7);// выравниваем числа по7 позиций

  cout << a[i][j];

 }

 cout << endl;

}

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

{

 for (int j = 0; j < 4; j++)

 {

  if (a[i][j] == 0)

   a[i][j] = 10;

 }

}

cout << "Введенная матрица после изменения:" << endl; //вывод матрицы B

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

{

 for (int j = 0; j < 4; j++)

 {

  cout.width(7);// выравниваем числа по7 позиций

  cout << a[i][j];

 }

 cout << endl;

}

system("pause");

return 0;

}

0,0(0 оценок)
Ответ:
YerasylAmangeldi
16.09.2020 02:37

Файл с фамилиями и ростом прикреплён.

#include <iostream>

#include <fstream>

#include <windows.h>

using namespace std;

class People {

public:

string surname;

int height;

};

signed main() {

ifstream f;

People ppl[15];

int j = 0;

People newPpl;

try {

 cout << "Input surname and height new people:\n";

 cin >> newPpl.surname >> newPpl.height;

 try {

  f.open("guys.txt");

  while (!f.eof()) {

   f >> ppl[j].surname >> ppl[j].height;

   j++;

  }

 }

 catch (...) {

  cout << "Error with file!";

 }

 int _minR = abs(newPpl.height - ppl[0].height);

 string buff = ppl[0].surname;

 for (int i = 0; i < 15; i++) {

  if (abs(newPpl.height - ppl[i].height) < _minR) {

   _minR = abs(newPpl.height - ppl[i].height);

   buff = ppl[i].surname;

  }

 }

 cout << endl << buff;

}

catch (...) {

 cout << "Error in main programm!";

}

return 0;

}


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