Answer to Question #161112 in C++ for tej

Question #161112

Fill in the blanks in the following program so that it draws the given picture. Each

figure is a rhombus with side 100 and interior angles (60, 120, 60, 120). The distance

between 2 adjacent rhombuses is 20 (between their closest vertices).


1
Expert's answer
2021-02-05T08:06:53-0500
#include <iostream>
#include <conio.h>
using namespace std;
int main() {
    int i, j, rows;
    char ch;
    cout << "Enter the number of rows\n";
    cin >> rows;
    cout << "Enter the Symbol for pattern\n";
    cin >> ch;
    cout<<"\n";
    i=1;
    while(i <= rows) {
        //outer while loop
        j = 1;
        while(j <= rows - i) {
            //inner while loop
            cout << " ";
            //print space
            j++;
        }
        j = 1;
        while(j <= rows){
            //inner while loop
            cout << ch;
            //print character after space
            j++;
        }
    cout << "\n";
    //move to next line
    i++;
    }
    getch();
    return 0;
}




Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog