format und variablen
This commit is contained in:
@@ -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);
|
||||
@@ -0,0 +1,6 @@
|
||||
size(800, 600);
|
||||
int x; // Deklaration x
|
||||
x = 50;
|
||||
int y; // Deklaration y
|
||||
y = 50;
|
||||
rect(x, y, 30, 30);
|
||||
@@ -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
|
||||
@@ -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
|
||||
}
|
||||
@@ -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);
|
||||
Reference in New Issue
Block a user