(What Does This Program Do?) What does the following program do?
Create a rectangle. The first integer is column count, the second is row count.
For example:
Enter two integers in the range 1-20:
5
10
@@@@@
@@@@@
@@@@@
@@@@@
@@@@@
@@@@@
@@@@@
@@@@@
@@@@@
@@@@@
123456789101112131415161718192021#include < iostream> using namespace std; int main() { int x; // declare x int y; // declare y // prompt user for input cout << "Enter two integers in the range 1-20: "; cin >> x >> y; // read values for x and y for ( int i = 1; i <= y; ++i ) // count from 1 to y { for ( int j = 1; j <= x; ++j ) // count from 1 to x cout << '@'; // output @ cout << endl; // begin new line } // end outer for } // end main
Solution:
For example:
Enter two integers in the range 1-20:
5
10
@@@@@
@@@@@
@@@@@
@@@@@
@@@@@
@@@@@
@@@@@
@@@@@
@@@@@
@@@@@
Post A Comment:
0 comments: