0

Write a C++ program that will print the pattern as shown below:
Output:
*
***
*****
*******
*********
*********
*******
*****
***
*

7
Contributors
13
Replies
82
Views
2 Years
Discussion Span
Last Post by dbfud1988
Featured Replies
  • `printf("*\n***\n*****\n*******\n*********\n*********\n*******\n*****\n***\n*");` Read More

  • 1

    I like it Moschops! Keep it simple... Read More

  • 1

    Here is #3... std::cout << "*" << std::endl << "***" << std::endl << "*****" << std::endl << "*******" << std::endl << "*********" << std::endl << "*********" << std::endl << "*******" << std::endl << "*****" << std::endl << "***" << std::endl << "*" << std::endl; Just pure C++ code! Read More

0

Do you know how to write an "Hello world." program in C++?
If yes, then just change the hello world in what Moschops wrote.
It is an answer to your question! Try it and see!

Edited by ddanbe: corection

0

Since this is posted in the C++ forum how about:

std::cout << "*\n***\n*****\n*******\n*********\n*********\n*******\n*****\n***\n*";

Edited by NathanOliver

1

Here is #3...

    std::cout << "*" << std::endl
              << "***" << std::endl
              << "*****" << std::endl
              << "*******" << std::endl
              << "*********" << std::endl
              << "*********" << std::endl
              << "*******" << std::endl
              << "*****" << std::endl
              << "***" << std::endl
              << "*" << std::endl;

Just pure C++ code!

Edited by rubberman

-1

it's code

//#include <iostream>
//using namespace std;

//main

int i , j;

int check = 0;
int ncout = 0;

for( i = 0 ; i<10 ; i++ ){

    if ( i > 5 ){
        ncout += 4 ;
    }else if( i == 5 ){
        ncout += 2 ;
    }

    check += (  i < 1 ) ? 1 : 2 ;

    for( j=0; j < check - ncout; j++ ){
        cout << "*";
    }

    cout << endl;

}

1222223.jpg

0

it's code @dbfud1988: first you should read the rules I guess, and second what do you think the other contributors posted other then code?

Edited by ddanbe: correction

-1

*
***
*****
*******
*********
*********
*******
*****
***
*
out put map

Edited by dbfud1988

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.