关于#矩阵#的问题,如何解决?

1.内容:使用函数输出字符矩阵:输入矩形的长度 length、宽度 width 和字符 ch,输出一个长宽分 别为 length 和 width 的实心字符矩阵。要求定义并调用函数 matrix(length, width, ch),它的功能 时在屏幕上显示长度为 length、宽度为 width,由字符 ch 组成的实心矩形图案。


#include <iostream>
using namespace std;

void matrix(int length, int width, char ch)
{
    for(int i=0;i<length;i++){
        for(int j=0;j<width;j++)
            cout << ch;
        cout << endl;
    }    
}

int main()
{
    int length,  width;
    char ch;
    cin >> length >> width >> ch;
    matrix(length, width, ch);
    return 0;
}