วันอาทิตย์ที่ 6 กันยายน พ.ศ. 2558
Lab 3 : Power of ten
void setup(){
size(400,300);
background(0);
int power=30;
powerTen(power);
}
void powerTen(int power){
String word;
int X=200;
int Y=100;
if (power == 6) {
word="Million";
} else if (power == 9) {
word="Billion";
} else if (power == 12) {
word="Trillion";
} else if (power == 15) {
word="Quadrillion";
} else if (power == 18) {
word="Quintillion";
} else if (power == 21) {
word="Sextillion";
} else if (power == 30) {
word="Nonillion";
} else if (power == 100) {
word="Googol";
} else {
word="-";
}
textAlign(CENTER);
textSize(20);
fill(#ffffff);
text("Power of ten is "+power,X,Y);
text("Word for that number is "+word,X,Y+100);
}
สมัครสมาชิก:
ส่งความคิดเห็น (Atom)
ไม่มีความคิดเห็น:
แสดงความคิดเห็น