fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. int row=7;
  6. for(int i=1;i<=row;i++){
  7. if(i<(row+1)/2){
  8. cout<<"*";
  9. for(int j=1;j<=((row-1)/2)-1;j++){
  10. cout<<" ";
  11. }
  12. cout<<"*";
  13. if(i==1){
  14. for(int j=1;j<=(row-1)/2;j++){
  15. cout<<"*";
  16. }
  17. }
  18. cout<<endl;
  19. }else if(i==(row+1)/2){
  20. for(int j=1;j<=row;j++){
  21. cout<<"*";
  22. }
  23. cout<<endl;
  24. }
  25.  
  26.  
  27.  
  28. }
  29. return 0;
  30. }
Success #stdin #stdout 0.01s 5316KB
stdin
Standard input is empty
stdout
*  ****
*  *
*  *
*******