Advertisement
camilosasuketbs

Untitled

Oct 4th, 2022
797
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.22 KB | Source Code | 0 0
  1. // ca2 Software Development by camilo on 2022-10-04 <3ThomasBorregaardSorensen!!
  2. #include "framework.h"
  3. #include <iostream>
  4.  
  5.  
  6. using namespace std;
  7.  
  8.  
  9. int twitch::octaelliptical_star_main()
  10. {
  11.    printf("Star Line Count? (negative for exiting...)");
  12.    int n;
  13.    cin >> n;
  14.    if (n < 0)
  15.    {
  16.  
  17.       return n;
  18.  
  19.    }
  20.    int extraline = (n % 2) == 0;
  21.    n /=2;
  22.    if (!extraline)
  23.    {
  24.       n++;
  25.    }
  26.    int a = 1;
  27.    while (a <= n) {
  28.       int k = 1;
  29.       while (k <= n - a) {
  30.          cout << " ";
  31.          k++;
  32.       }
  33.  
  34.       int j = 1;
  35.       while (j <= 2 * a - 1) {
  36.          cout << "*";
  37.          j++;
  38.       }
  39.  
  40.       cout << endl;
  41.       a++;
  42.    }
  43.  
  44.    if (extraline)
  45.    {
  46.       a--;
  47.       int k = 1;
  48.       while (k <= n - a) {
  49.          cout << " ";
  50.          k++;
  51.       }
  52.  
  53.       int j = 1;
  54.       while (j <= 2 * a - 1) {
  55.          cout << "*";
  56.          j++;
  57.       }
  58.  
  59.       cout << endl;
  60.  
  61.  
  62.    }
  63.  
  64.  
  65.    int i = n - 1;
  66.    while (i >= 1) {
  67.       int p = 1;
  68.       while (p <= n - i) {
  69.          cout << " ";
  70.          p++;
  71.       }
  72.       int c = 1;
  73.       while (c <= 2 * i - 1) {
  74.          cout << "*";
  75.          c++;
  76.       }
  77.  
  78.  
  79.       cout << endl;
  80.       i--;
  81.  
  82.    }
  83.  
  84.    return 0;
  85. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement