|
|
1.1 ! root 1: // String test program. exercise SubStrings ! 2: ! 3: #include "String.h" ! 4: ! 5: void ! 6: spitIt(String x) ! 7: { ! 8: String s = "<<x>>"; ! 9: for ( int i = 0; i <= length(x); i++ ) { ! 10: for ( int j = 0; j <= length(x) - i; j++ ) { ! 11: String y = x; ! 12: y ( i, j ) = s; ! 13: cout << y << "\n"; ! 14: } ! 15: } ! 16: } ! 17: ! 18: main(int argc, char **argv) ! 19: { ! 20: while ( argc-- ) { ! 21: String x(*argv++); ! 22: cout << x << "\n"; ! 23: spitIt ( x ); ! 24: cout << x << "\n"; ! 25: } ! 26: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.