Help troubleshooting code that prints a square
I am trying to make a program that outputs a square sized via user input. This is the code I have: --------------------------------------------- #include <iostream> #include <string> using namespace std; string square(int x, int y){ char unit = '#'; string row(x, unit); for(int i;i<=y;i++){ cout << row << "\n"; } } int main(){ int xx; int yy; cin >> xx; cin >> yy; cout << square(xx,yy); return 0; } --------------------------------------------- The output is something like: ------------------------ ### ├ÉÉÉÉÉ■ ╘ ■ ë◄∟vÉÉÉÉÉΦ=π ├R¢ ------------------------ So obviously it's returning crap. I just don't know why. Thanks in advance for any help. Also, I'd like to try and keep the code as similar to what I already wrote as possible, i.e., not rewrite the code altogether, but fix the code.