You are viewing a single comment's thread. Return to all comments →
Ussing operator overloading for fun, we all know it is not necessary.
string operator*(const std::string& str, int count){ std::string result = ""; for (int i = 0; i < count; ++i) { result += str; } return result; } string operator*(int count, const string& str) { return str * count; } void staircase(int n) { int steps = n; while (n-->0) { cout<<" "s*n + "#"s*(steps-n)<<endl; } }
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 →
Ussing operator overloading for fun, we all know it is not necessary.