#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;
}
uses graphabc;var s,f,i,o: string; j: byte; pic: integer;begin
s:='AVALON';f:='FAMILY';i:='name';o:='second name';
setfontcolor(clred);setwindowsize(550,250);setfontsize(20);setfontstyle(fsbold);for j:=1 to length(s) do textout(10,(j*40)-40,s[j]);setpencolor(clred);setbrushcolor(clred);rectangle(30,120,550,125);setfontcolor(clblue);setbrushcolor(clwhite);setfontname('Tahoma');setfontsize(16);SetFontStyle(fsnormal);textout(300,10,f);SetFontStyle(fsItalic);textout(300,50,i);textout(300,90,o);setpenwidth(6);for j:=1 to 10 do arc(500+(j*30),420,300,0,180);setfontname('Times');setfontsize(26);textout(40,150,'Something for good');end.