Дана программа. нужно добавить кнопку смены ширины кисти и смены цвета. 100
from turtle import*
t=turtle()
t.color("red")
t.shape("circle")
step=50
def stepup():
if t.ycor()> 250:
t.goto(t..ycor()-step)
else:
t.goto(t..ycor()+step)
def stepdown():
if t.ycor()< -250:
t.goto(t..ycor()+step)
else:
t.goto(t..ycor()-step)
def stepright():
if t.xcor()> 250:
t.goto(t.xcor()-step,t.
else:
t.goto(t.xcor()+step,t.
def stepleft():
if t.xcor()< -250:
t.goto(t.xcor()+step,t.
else:
t.goto(t.xcor()-step,t.
scr=t.getscreen()
scr.onkey(stepup,'up')
scr.onkey(stepdown,'down')
scr.onkey(stepleft,'left')
scr.onkey(stepright,'right')
scr.listen()
#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;
}