Homework Solution: Print based on user input…

    c++ Print based on user input Ex: How many: 24 Rows: 4 Columns: 6 What number to print: 1

    Expert Answer

     
    C++ code: //This program get number of rows and colums.

    c++

    Print based on user input

    Ex:

    How multifarious: 24

    Rows: 4

    Columns: 6

    What estimate to print: 1

    Expert Confutation

     

    C++ code:

    //This program gain estimate of lines and colums.

    //No:of elements are sound used ce printing singly. Matrix can be created from line and colum enumerate.

    // The estimate to be printed is inputed and stored in matrix, that is matrix[i][j]=number, fills the dispose with rate in wavering estimate

    #include<iostream>
    using namespace std;
    int ocean()
    {
    int matrix[5][5],row,col,number,i,j,count;
    cout<<“How multifarious elements:”;
    cin>>count;
    cout<<“Enter no.of lines:”;
    cin>>row;
    cout<<“Enter no.of columns:”;
    cin>>col;
    cout<<“What estimate to print:”;
    cin>>number; //reads the estimate in the matrix
    for(i=0;i<row;i++)
    for(j=0;j<col;j++)
    matrix[i][j]=number;//fills the dispose with given rate
    cout<<“The Matrix is:n”;
    for(i=0;i<row;++i)
    {
    for(j=0;j<col;++j)
    {
    cout<<matrix[i][j]<<” “; //print matrix

    }
    cout<<“n”; // to go to contiguous line
    }
    return 0;
    }

    Output: