The % (per-cent) symbol traces back to an era when it meant a variable in the most literal sense. An unknown at time of writing. Be darned if I can find one good example, right now, but my peers will hopefully weigh in. From this is born, modulo formatting.
The symbol is twofold. In the string, a placeholder signal; and after the string, it acts as a parameter list signal. The modulo character is a signal.
Signal means indicator but it also means, heads up!
You can also find it referred to as printf formatting, as it was implemented in C as part of the printf function. Don’t know whether printf was there from the start, but C has been around since '72. (Which is a lot longer than I!)
If you go back further, that method of formatting existed in BCPL (which influenced B, which in turn influenced C). Here’s an example of that in the writef function, in an implementation of the n-queens problem in BCPL.
LET TRY(LD, ROW, RD) BE
TEST ROW = ALL THEN
COUNT := COUNT + 1
LET POSS = ALL & ~(LD | ROW | RD)
UNTIL POSS = 0 DO $(
LET P = POSS & -POSS
POSS := POSS - P
TRY(LD + P << 1, ROW + P, RD + P >> 1)
LET START() = VALOF $(
ALL := 1
FOR I = 1 TO 12 DO $(
COUNT := 0
TRY(0, 0, 0)
WRITEF("%I2-QUEENS PROBLEM HAS %I5 SOLUTIONS*N", I, COUNT)
ALL := 2 * ALL + 1
i was able to follow everything done up to this point but this concept wasn’t covered in the modules. Would anyone be able to provide an alternative to coding the print statemetnt without having to do this?