Задание на Pygame На Python . НУЖНО ДОБАВИТЬ ФОН , ИЗОБРАЖЕНИЕ Я СКИНУЛ ,И НАЗВАТЬ ЕГО fon К ЭТОМУ КОДУ ЧТОБ ОНА РАБОТАЛА: import pygame from random import randint
HEIGHT = 70 WIDTH = 40 SPEED = 2 y = 0 - HEIGHT position = randint(1,3) if position == 1: x = 10 elif position == 2: x = 130 elif position == 3: x = 250
gameon = True while gameon: events = pygame.event.get() for i in events: if i.type == pygame.QUIT: exit() elif i.type == pygame.KEYDOWN: if i.key == pygame.K_LEFT: if xpos > 10: xpos -= 120 if i.key == pygame.K_RIGHT: if xpos < 250: xpos += 120
if y >= WIN_HEIGHT + HEIGHT: SPEED += 0.7 y = 0 - HEIGHT position = randint(1,3) if position == 1: x = 10 elif position == 2: x = 130 elif position == 3: x = 250 else: y += SPEED sc.fill(fon) sc.blit(z, (x, y)) sc.blit(kor, (xpos, 405)) pygame.display.update()
Var a:array[1..100,1..100] of integer; c:array[1..20,1..20] of real; b:array[1..20,1..20] of real; i,j,n,k:integer; t:real; r:integer; begin randomize; t:=0; Writeln('Введите порядок матрицы: '); readln(n); for i:=1 to n do for j:=1 to n do begin a[i, j] := random(10); end; for i:=1 to n do for j:=1 to n do begin b[i,j]:=1/i+j-1; end; for i:=1 to n do for j:=1 to n do begin for k:=1 to n do begin t :=t+a[i,k]*b[k, j]; end; c[i,j]:=t; t:=0; end; for i:=1 to n do begin for j:=1 to n do begin write(' ',c[i,j]:2:2); end; Writeln; end;
#include <iostream> #include <cstdlib> // содержит srand() и rand() #include <ctime> using namespace std;
int main() { int n=10; int mas[n] = {}; int tmp,j=0; cout<<"random number"; cout<<endl; // начальная установка генератора случ. чисел srand(time(NULL)); // заполнение массива случайными числами for (int i = 0; i < n; i++) { mas[i] = rand()/100; cout<<mas[i]<<" "; } cout<<endl; // перестановка элементов for (int i = 0; i < n/2; i++) { tmp=mas[i]; mas[i]=mas[2*(i+1)-1]; j=2*i; while (j>i) { mas[j+1]=mas[j]; j--; } mas[i+1]=tmp; } //"массив после замены" for (int i = 0; i < n; i++) cout<<mas[i]<<" "; cout<<endl; system("pause"); return 0; }
0,0(0 оценок)
Полный доступ
Позволит учиться лучше и быстрее. Неограниченный доступ к базе и ответам от экспертов и ai-bota
Оформи подписку