You are viewing a single comment's thread. Return to all comments →
I just finished with the one that uses setw
int main() { string::size_type n; cin >> n; auto width = n; while(n--) cout << setw(width) << string(width - n, '#') << endl; return 0; }
Could use s.substring(0, witdth - n, '#') from string s(width, '#'). Not sure if compiler would generate different code.
Seems like cookies are disabled on this browser, please enable them to open this website
Staircase
You are viewing a single comment's thread. Return to all comments →
I just finished with the one that uses setw
Could use s.substring(0, witdth - n, '#') from string s(width, '#'). Not sure if compiler would generate different code.