วันอาทิตย์ที่ 6 กันยายน พ.ศ. 2558

Lab3-Power of 10



int space = 70;
void setup() {
  background(#2222FF);
  size(400, 250);

  int x = width/2, y = 70;
  textAlign(CENTER);
  textSize(60);
  fill(255);
  text("Power of 10", x, y);
  power_of_ten(x, y+space, 9);
}
void power_of_ten(int x, int y, int power) {
  textAlign(CENTER);
  textSize(40);
  fill(0);
  text("10^"+power, x, y);
  if (power == 6) {
    text("'Million'", x, y+space);
  } else if (power == 9) {
    text("'Billion'", x, y+space);
  } else if (power == 12) {
    text("'Trillion'", x, y+space);
  } else if (power == 15) {
    text("'Quadrillion'", x, y+space);
  } else if (power == 18) {
    text("'Quintillion'", x, y+space);
  } else if (power == 21) {
    text("'Sextillion'", x, y+space);
  } else if (power == 30) {
    text("'Nonillion'", x, y+space);
  } else if (power == 100) {
    text("'Googol'", x, y+space);
  }
}

ไม่มีความคิดเห็น:

แสดงความคิดเห็น