using namespace std;
for (int i=5; i>=1; i--) // A loop for spaces
for (int Space=1; Space <= i ; Space++)
}// Printing Spaces
for (int Star=5; Star>=i; Star--) // loop for stars
cout<<"* "; // Notice that one extra space, that creates the equi. triangle shape.. But don't just copy the code. See how it works. use algorithms to crack the problems. Cheers
Hope that helps. But really dude, try to break the algorithms. Try to break the solution in steps.
Even in this example, I first created those spaces. (I couldn't see them, so swapped with dots and when got the perfect result, changed back to spaces)
Then I created those stars. All i needed was one space after them. This is the way you learn. For more, join my page:
Need some help with this Array. I am trying to get the sum of the even numbers and the sum of the odd numbers using a for each loop. I know the answers to what I am trying to achive are sum of even = 84 and the sum of ...
I have a 2d matrix with dimension (3, n) called A, I want to calculate the normalization and cross product of two arrays (b,z) (see the code please) for each column (for the first column, then the second one and so on).
the function that I created to find the ...