Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Create a shape in C++

Tags:

c++

shapes

I want to create a shape like this:

ccccccc
cccccc
ccccc
cccc
ccc
cc
c

My code is:

#include <iostream>

using namespace std;

int main(){
    int i, j;
    for(i = 0; i < 7; i++){
        for(j = 7; j > 7; j--){
            cout << 'c';
        }
        cout << endl;
    }
    return 0;
}

But in terminal the output I get is some blank lines.

What am I doing wrong?

enter image description here

like image 297
Rikas Avatar asked Apr 24 '15 14:04

Rikas


People also ask

How do you draw a circle in C?

h contains circle() function which draws a circle with center at (x, y) and given radius. Syntax : circle(x, y, radius); where, (x, y) is center of the circle. 'radius' is the Radius of the circle.


1 Answers

for(j = 7; j > 7; j--){ This expression is always false.

You need to write for(j = 7; j > i; j--){

like image 136
Giorgos Dimtsas Avatar answered Sep 30 '22 11:09

Giorgos Dimtsas