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. cout<<endl;
  18. }
  19. }
  20.  
  21.  
  22.  
  23. }
  24. return 0;
  25. }
Success #stdin #stdout 0.01s 5324KB
stdin
Standard input is empty
stdout
*  ****
*  **  *