// Day 4 // Example: Maths // mjh-2013 // initialize program size(600, 400); background(250, 250, 200); textSize(40); fill(0); // // uncomment out different blocks of code // text("Some Math", 10, 50); line(10, 53, 590, 53); /* Basic INTEGER arithmetic text( 12 + 18, 25, 100); text( 12 - 18, 25, 150); text( 12 * 18, 25, 200); text( 12 / 18, 25, 250); text( 12 % 18, 25, 300); */ /* integer arithmetic using a variable */ int x; x = 12; text( x + 18, 25, 100); text( x - 18, 25, 150); text( x * 18, 25, 200); text( x / 18, 25, 250); text( x % 18, 25, 300); text("integers", 25, 350); /* (approximate) real number arithmetic */ float xreal = 12; text( xreal + 18, 225, 100); text( xreal - 18, 225, 150); text( xreal * 18, 225, 200); text( xreal / 18, 225, 250); text( xreal % 18, 225, 300); text("floats", 225, 350);