mariokhab
?>

Составьте программу, которая формирует массив из шестнадцати чисел от -20 до 20 и находит индексы четных элементов.

Информатика

Ответы

barg562
Program z1;var a:array[1..16] of integer;    i:integer;beginfor i:=1 to 16 do a[i]:=random(40)-20;for i:=1 to 16 do write(a[i],' ');for i:=1 to 16 do if a[i] mod 2=0 then writeln(i);end.
lena260980

#include <iostream>

#include <cstdlib>

#include <ctime>

#include <vector>

#include <algorithm>

using namespace std;

int main() {

vector< vector<int> > arr;

arr.resize(8);

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

 arr[i].resize(7);

}

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

 for (int j = 0; j < 7; ++j) {

  arr[i][j] = rand();

  cout << arr[i][j] << " ";

  if (j == 6) {

   cout << endl;

  }

  }

}

swap(arr[3], arr[0]);

swap(arr[4], arr[7]);

cout << endl;

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

 for (int j = 0; j < 7; ++j) {

  cout << arr[i][j] << " ";

  if (j == 6) {

   cout << endl;

  }

 }

}

}

zyf0066

#include <iostream>

#include <cstdlib>

#include <ctime>

#include <vector>

#include <algorithm>

using namespace std;

int main() {

vector<int> arr;

int size, min(9999999), sum(0);

cout << "N: ";

cin >> size;

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

 int temp;

 cout << "Element #" << i + 1 << ": ";

 cin >> temp;

 arr.push_back(temp);

 if (temp >= 0 && temp < min) {

  min = temp;

 }

 if ((i + 1) % 2 == 0) { // нумеруем элементы с 1

  sum += temp;

 }

}

cout << "Min: " << min << endl;

cout << "Sum: " << sum << endl;

for (int i = arr.size()-1; i>=0; --i) {

 cout << arr[i] << " ";

}

}


Нужно написать программу на c++ 15. Дан одномерный массив, состоящий из N вещественных элементов. 15

Ответить на вопрос

Поделитесь своими знаниями, ответьте на вопрос:

Составьте программу, которая формирует массив из шестнадцати чисел от -20 до 20 и находит индексы четных элементов.
Ваше имя (никнейм)*
Email*
Комментарий*

Популярные вопросы в разделе

Tanyamitia
izumrud153
MISAKOVNA49
artemyanovich8
sharaeva-is
Verakravez8790
Femida76
pk199888
Strelkov-Roman1263
vsnimschikov391
vifslafes
kyzua2475
ГегамБукреев830
ГармаеваЕкатерина1637
Kochinev7