Do while

I am trying to make 3*5 rectangle of # using do.....while statements but I am stuck and i can't go further from here.
Any help would be appreciated. Thanks a lot.

//complier directives

#include<iostream>

using namespace std;

//main body

int main ()
{
//local identifiers
int length,width,Done;
char character,Again;
//input module

cout<<"Please enter the length and width of the rectangle seperated by a space:\n";
cin>>Length>>width;
cout<<"Please enter your design character: \t";
cin>>character;
for(int i=0; i<length; i++)
{
for(int j=0; j<width; j++)
cout<<character;
cout<<endl;
}//end i loop
}
@evan1991

The on problem I see with your program, is you are using a different variable for length. Change it to a lower case 'L' for the input, and your program will work. Also, since main is declared as 'int main()', you should put 'return 0;', before the last parenthesis in your program.

thanks and I question, I am still stuck up with how to input everything with do...while loop to make a rectangle?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# include <iostream>
using namespace std;

int main ()
{
    //local identifiers
    int length,width;
    char character;
    //input module

    cout << "Please enter the length and width of the rectangle seperated by a space:\n";
    cin >> length >> width;
    cout << "Please enter your design character: \t";
    cin >> character;

    int i=0,j=0;

    do
    {
        j=0;

        do
        {
            cout << character;
        }while(++j<width);

        cout << endl;

    }while(++i<length);

    return 0;
}


Hope that helps
This really helped me. But i couldn't make my drawing as 3*5 rectangle:
#####
#####
#####
But you did helped so I really appreciate your help!!
It's easy when you encounter
Please enter your design character:
enter the dash sign ,that all you need to do
Topic archived. No new replies allowed.