Advertisement
InasAwad

Untitled

Feb 21st, 2021
1,011
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.51 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4.  
  5. void main()
  6. {
  7.     /*
  8.     for (Initialization; Condition; increment)
  9.     {
  10.  
  11.     }
  12.     */
  13.  
  14.     /*for (int i = 0; i < 10; i++)
  15.     {
  16.         cout << "Hello World!" << endl;
  17.     }*/
  18.  
  19.  
  20.     int spaces = 200;
  21.     int stars = 1;
  22.     for (int i = 1; i <= 15; i++)
  23.     {
  24.         for (int j = 0; j < spaces; j++)
  25.         {
  26.             cout << " ";
  27.         }
  28.  
  29.         spaces--;
  30.  
  31.         /*for (int j = 0; j < i * 2 - 1; j++)
  32.         {
  33.             cout << "*";
  34.         }*/
  35.  
  36.         for (int j = 0; j < stars; j++)
  37.         {
  38.             cout << "*";
  39.         }
  40.  
  41.         cout << endl;
  42.         stars += 2;
  43.     }
  44.  
  45.  
  46.     /*
  47.     while(condition)
  48.     {
  49.     }
  50.     */
  51.  
  52.     /*int i = 0;
  53.     while (true)
  54.     {
  55.         cout << "Hello World!" << endl;
  56.         i++;
  57.         if (i >= 10)
  58.             break;
  59.     }*/
  60.  
  61.     int i = 0;
  62.     spaces = 200;
  63.     stars = 1;
  64.     while (i < 15)
  65.     {
  66.         int j = 0;
  67.         while (j < spaces)
  68.         {
  69.             cout << " ";
  70.             j++;
  71.         }
  72.  
  73.         spaces--;
  74.         j = 0;
  75.  
  76.         while (j < stars)
  77.         {
  78.             cout << "*";
  79.             j++;
  80.         }
  81.  
  82.         stars += 2;
  83.         cout << endl;
  84.         i++;
  85.     }
  86.  
  87.     /*
  88.    
  89.     do
  90.     {
  91.     }while(condition);
  92.    
  93.     */
  94.  
  95.     int x = 10;
  96.     do
  97.     {
  98.         cout << "Hello World!" << endl;
  99.         x++;
  100.     } while (x < 10);
  101.  
  102.     while (x < 10)
  103.     {
  104.         cout << "Hello World!" << endl;
  105.     }
  106. }
  107.  
  108.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement