fork(1) download
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7. int N = 7;
  8. for(int i = 0; i < N; ++i)
  9. {
  10. for(int j = 0; j < N; ++j)
  11. cout << (((j >= i && j < N-i) || (j <= i && j >= N-i-1)) ? "* " : " ");
  12. cout << "\n";
  13. }
  14. }
  15.  
Success #stdin #stdout 0.01s 5540KB
stdin
Standard input is empty
stdout
* * * * * * * 
  * * * * *   
    * * *     
      *       
    * * *     
  * * * * *   
* * * * * * *