#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2013
    Posts
    2
    Rep Power
    0

    C++ Asterisk Pyramid Program into a flowchart


    The below code is what I've come up with for a program that will output a pyramid with a odd number of asterisks per line.

    Code:
    // Stars(asterisk) pyramid perfectly packed into each space.
    #include<iostream>
    using namespace std;
    
    int main()
    {
    int count = 0;
    
    for (int width = 0; width <= 10; width++)
    {
    for (int alignLeft = width; alignLeft <= 15; alignLeft++)
    {
    cout << " ";
    }
    for (int space = 1; space < count; space++)
    {           
    cout << "*";                 
    }        
    cout << endl;
    count += 2;     
    }	   return 0;
    }
    Now I have to convert this code into a flowchart in Visual Logic. Below is a screenshot of what I have already.

    Flowchart
    http://i39.tinypic.com/mt8d4k.png


    I'm confused on where to place the algorithms for the asterisks and spaces to be printed per line. I know the alogrithms are asterisks = 2*usernumber - 1 and spaces = usernumber -1.

    Any help is greatly appreciated. I've been working on this for hours and keep getting incorrect results.
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2013
    Posts
    159
    Rep Power
    19
    Also posted here.

    Jim
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2013
    Posts
    2
    Rep Power
    0
    Originally Posted by jimblumberg
    Also posted here.
    Jim
    Yes, I'm trying to use different forums to actually get an answer to this issue as quickly as possible?
  6. #4
  7. Contributed User
    Devshed Specialist (4000 - 4499 posts)

    Join Date
    Jun 2005
    Posts
    4,392
    Rep Power
    1871
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper

IMN logo majestic logo threadwatch logo seochat tools logo