if the program asks the user to enter any character (symbol) E.g. #,*,&....
and then displays this charecter according to the elements of matrix arr[][]
for example if the elements of matrix arr[2][2] are : 3 6 2 1
the histogram will be in this form:
char histogram() // dont forget to change the prototype to char
{
char character;
cout<<" Please enter the display character: ";
cin>>character;
return character;
}//although you could have easily done it without function :D
then add this to your main()
1 2 3 4 5 6 7 8 9 10 11 12
cout<<endl<<endl;
char ch;
ch=histogram();
for(i=0;i<rows;i++)
{
for(j=0;j<cols;j++)
{
cout<<arr[i][j]<<" ";
for(int l=0;l<arr[i][j];l++)//this is the code you were looking for
cout<<ch;//I am just iterating form 0 to number and printing char
cout<<endl<<endl;
}
I checked it and here's the possible output
enter rows and cols : 2 2
enter element 1: 3
enter element 2: 6
enter element 1: 2
enter element 2: 1
Matrix :
3 6
2 1
Please enter the display character: *
3 ***
6 ******
2 **
1 *
Exit code: 0 (normal program termination)