About 5,070,000 results
Open links in new tab
  1. How to draw a rectangle for c++ with loops? - Stack Overflow

    Jun 26, 2012 · Draws a rectangle where int height is the height and int width is the width. using std::cout; cout << "+"; for (int i = 0; i < width - 2; i++) cout << "-"; cout << "+\n"; for (int i = 0; i < height - 2; i++) cout << "|"; for (int j = 0; j < width - 2; j++) cout << " "; cout << "|\n"; cout << "+"; for (int i = 0; i < width - 2; i++) cout << "-";

  2. C++ Program to Draw Rectangle using For loop - W3CODEWORLD

    Dec 6, 2021 · In this article, you will learn how to draw a rectangle in c++ using the for loop. int main() { int r = 0, c = 0, i, j; // r - denotes the number of rows // c - denotes the number of columns cout << "-----Enter the number of rows & columns-----\n"; cin >> r >> c; for (i = 1; i <= r; i++) { for (j = 1; j <= c; j++) {

  3. C++ FOR BEGINNERS (2020) - How to draw rectangle shape in C++ ... - YouTube

    Jun 4, 2020 · In this video, I'll explain how and when is nested for loop used, and I'll also show how you can draw a rectangle shape that has the desired width and height and symbol that user...

  4. C++ How to draw a Rectangle & Square on a Console | for loops …

    In this video: Beginners lesson / tutorial : cout printing shape using nested for loop s to console and file. Pattern printing - char type characters.In this...

  5. How do I draw an empty rectangle given its width and height in C?

    Given the width and the height, the compiler should draw a rectangle. I have therefore decided to make use of for loops, which look like the smartest way to do the job. Here is the code I have been using: printf("Please insert the value of the width.\n"); scanf("%d", & width); printf("Please insert the value of the height.\n");

  6. Drawing shapes using for loops - C++ Forum - C++ Users

    Mar 10, 2012 · Filled Rectangle" << endl; cout << "6. Unfilled Rectangle" << endl; cout << "7. Exit\n" << endl; cin >> choice; // ASK, READ AND VALIDATE CHOICE WITH while LOOP.

  7. C++ FOR BEGINNERS (2025) - How to draw rectangle shape in C++ ...

    This video is a tutorial on drawing shapes using C++. The instructor explains how to create a rectangle shape based on user-defined height, width, and symbol using nested for loops. Starting with user input, the video demonstrates how to set up …

  8. C++ program to print a rectangle using star or any other …

    With this program, you will learn how to take user inputs, how to run loops and how to print on console in C++. To print a rectangle, we need the height and width for the rectangle and we can print the rectangle based on these two values. We need two nested loops for that.

  9. c++ - Draw Rectangle Using Loops [SOLVED] | DaniWeb - DaniWeb

    He gives you an explanation and examples on how to do both a hollow and non-hollow rectangle. Change the System.out.print and System.out.println statements to the appropriate cout statements and what works in Java will work in C++. If you don't understand, please ask a more specific question.

  10. c++ - Use of for loops to create shapes with asterisks - Stack Overflow

    Nov 9, 2015 · for (m = 0; m<10; m++) // this one loops over the rows of the shape { for (n = 0; n<m; n++) cout << " "; // to leave spaces before the shape for (n = 0; n<(19-2*m); n++) cout << "*"; // to fill the shape with * for (n = 0; n<m; n++) cout << " "; // to leave spaces after the shape cout << endl; // change line }

Refresh