recursive function and 2-d arrays c++ -
alright, have input looks this:
1 6 2 3 4 1 8 3 4 7 2 1st # represents number of dimensions of array 2nd # = # of elements in array. 3rd # = rows of array (index) 4th # = columns
write segment of code print out indices of array. example, output of 2nd line should like:
00 01 02 03 10 11 12 13 20 21 22 23
i hope makes sense. understand how write code without recursion. it's matter of loops , cout statements can't figure out how use recursion. simplest case, 1-dimensional array, we'd write out code second simplest case have use recursion work next 3rd , 4th etc cases.
one way recursively write function takes number p
, string of numbers ones in input file. function prints out results describe, uses p
prefix. f(99, 1 4)
print:
990 991 992 993
is enough of hint, or should go little farther?
Comments
Post a Comment