The page is the program

Everything below was worked out by the server while this page was being sent. Open index.icpp.html in an editor and you will find the code that produced it, not the output.

1. Printing

A block runs between <?icpp and ?>, and iprint writes into the page.

Hello, ", $name, ". This page was built on ", icpp_date_string(), ".

"); ?>

2. A loop, and a table built from it

No template language and no placeholders — a for loop that prints rows.

nn squaredrunning total"); for ($i = 1; $i <= 8; $i = $i + 1) { $total = $total + ($i * $i); iprint("", $i, "", $i * $i, "", $total, ""); } iprint(""); iprint("

The squares of 1 to 8 add up to ", $total, ".

"); ?>

3. Your own functions

From tempconv.c, included at the top of this page. A function must be defined above any call that passes it arguments: ICPP has no forward declarations, so within a file definition order is call order.

°F°C"); for ($f = 0; $f <= 100; $f = $f + 20) { $c = celsius($f); iprint("", $f, "", $c, "", verdict($c), ""); } iprint(""); ?>

4. Text, and the string builtins

"); iprint("
  • the raw value, between brackets: [", $s, "]
  • "); iprint("
  • icpp_trim: [", $trim, "]
  • "); iprint("
  • icpp_strlen: ", icpp_strlen($trim), " characters
  • "); iprint("
  • icpp_upper: ", icpp_upper($trim), "
  • "); iprint("
  • icpp_strstr for 'Plus': position ", icpp_strstr($trim, "Plus"), "
  • "); iprint("
  • icpp_concat: ", icpp_concat($trim, " — built on the fly"), "
  • "); iprint(""); ?>

    Where to go next