format und variablen

This commit is contained in:
2023-09-26 12:28:28 +02:00
parent 4d84f83ac5
commit c00b7c1e38
10 changed files with 47 additions and 18 deletions

View File

@@ -0,0 +1,8 @@
size(800, 600);
float a; // Deklaration a
a = 2;
float b; // Deklaration b
b = 1;
float c; // Deklaration c
c = a + b / 2; // Durchschnitt a und b
println(c);

View File

@@ -0,0 +1,6 @@
size(800, 600);
int x; // Deklaration x
x = 50;
int y; // Deklaration y
y = 50;
rect(x, y, 30, 30);

View File

@@ -0,0 +1,7 @@
size(800, 600);
int x; // Deklaration x
x = 10;
int y; // Deklaration y
y = 10;
rect(x, y, 30, 30); // Quadrat eins
rect (x+50, y+50, 30, 30); // Quadrat zwei

View File

@@ -0,0 +1,12 @@
void setup() {
size(800, 600);
}
void draw() {
background(0); // Hintergrund schwarz
fill(255, 255, 0);
ellipse(mouseX, mouseY, 190, 190); // Gesicht
arc(mouseX, mouseY+10, 130, 90, radians(0), radians(180)); // Mund
ellipse(mouseX-40, mouseY-30, 40, 40); // Auge links
ellipse(mouseX+40, mouseY-30, 40, 40); // Auge rechts
}

View File

@@ -0,0 +1,8 @@
size(800, 600);
float muesliGroesse1 = 700;
float muesliPreis1 = 3.99;
float muesliGroesse2 = 500;
float x = (muesliPreis1/muesliGroesse1);
float y = (x*muesliGroesse2);
float muesliPreis2 = y;
println(muesliPreis2);