C++: Displaying characters -
i'm learning , improving programming skills "think programmer" book , asked display kind of pyramid.
######## ###### #### ##
i did code
for(int = 0; < 4; i++){ for(int k = 0; k < i; k++) cout << ' '; for(int j = 0; j < 8 - * 2; j++) cout << '#'; cout << '\n'; }
but... questions "using same rule shapes programs earlier in chapter (only 2 output statements—one outputs hash mark , 1 outputs end-of-line), write program produces following shape:"
i'm not sure, possible display 2 statements , without using space character?
edit.
thanks answer guys. according author should cout << '#'
, cout << '\n'
. , here point, because seems manipulating methods or functions not option.
write program uses 2 output statements, cout << "#" , cout << "\n", produce pattern of hash symbols shaped ... of course use of loops :p
unfortunately, answer question simpler: author error. first few questions should have been worded allow use of single space output (cout << " ";). don't know how missed in editing, , apologize confusion has caused. in general, exercise intended force reader go "digging" clear on point.
by way, , other issues first edition discussed in document can found on site here. if have further questions or problems book, please contact me.
Comments
Post a Comment