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. }else{
  25. if(i>(row+1)/2){
  26. if(i==row){
  27. for(int j=1;j<=(row-1)/2;j++){
  28. cout<<"*";
  29. }
  30. }else{
  31. for(int j=1;j<=(row-1)/2;j++){
  32. cout<<" ";
  33. }
  34. }
  35. cout<<"*";
  36. for(int j=1;j<=((row-1)/2)-1;j++){
  37. cout<<" ";
  38. }
  39. cout<<"*";
  40. cout<<endl;
  41. }
  42.  
  43. }
  44.  
  45.  
  46.  
  47. }
  48. return 0;
  49. }
Success #stdin #stdout 0s 5312KB
stdin
Standard input is empty
stdout
*  ****
*  *
*  *
*******
   *  *
   *  *
****  *