Changeset 1697c40 for doc/theses/jiada_liang_MMath/planet.cfa
- Timestamp:
- Aug 4, 2024, 11:47:20 AM (4 months ago)
- Branches:
- master
- Children:
- 065de93
- Parents:
- b797fe36
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
doc/theses/jiada_liang_MMath/planet.cfa
rb797fe36 r1697c40 33 33 double earthMass = earthWeight / surfaceGravity( EARTH ); 34 34 35 Planet p = fromInt( prng( __count_e__( Planet ) ) ); // select a random orbiting body35 Planet p = fromInt( prng( countof( Planet ) ) ); // select a random orbiting body 36 36 // Planet p = fromInt( prng( 9 ) ); // select a random orbiting body 37 37 choose( p ) { 38 38 case MERCURY, VENUS, EARTH, MARS: 39 sout | label E( p ) | "is a rocky planet";39 sout | label( p ) | "is a rocky planet"; 40 40 case JUPITER, SATURN, URANUS, NEPTUNE: 41 sout | label E( p ) | "is a gas-giant planet";41 sout | label( p ) | "is a gas-giant planet"; 42 42 default: 43 sout | label E( p ) | "is not a planet";43 sout | label( p ) | "is not a planet"; 44 44 } 45 45 46 46 47 for ( p; enumPlanet ) {47 for ( p; Planet ) { 48 48 sout | "Your weight on " 49 | (p == MOON ? "the" : "") | label E(p)49 | (p == MOON ? "the" : "") | label(p) 50 50 | "is" | wd( 1,1, surfaceWeight( p, earthMass ) ) | "kg"; 51 51 }
Note: See TracChangeset
for help on using the changeset viewer.