Sean Magee
Ranch Hand
Posts: 69
I have this assignment due fairly soon. I was wondering if anyone could help me on one particular task. I have to make some sort of calculation, when the calculation becomes TRUE i need to add an asterisk to an element in a array, (or however i want to do it).

For example, if calculation is 2, 8 times, i need result 2 to print out 8 asterisks. and for calculation 3. hits 4 times, i need a result 3 to print out 4 times.

for ex.

result 1 ****
result 2 *
result 3 ******
result 4 ****

Everytime i run the program the out put should be different.

Now, I dont want the answer, or exactly how to do this.

I just need help with how I would add an asterisk, or a char, everytime something is true or whatever.

Jeroen Wenting
Ranch Hand
Posts: 5093
what about just keeping a count of the number of times each of your calculations returns true?
You could use an array of integers that for example.

Sean Magee
Ranch Hand
Posts: 69
Ok, here is my code so far. Everything works just how it should.

The output should look like this

***
*****
*******
*********
************
***************
************
*********
*******
****
***

Of course it should vary,but it should alway be represented as a bellcurve however atm the asterisks are represented as numbers, I do not understand how to make the conversion over.

And, if anyone sees anything that deserves constructive criticism, please feel free.

Any Help would be greatly appreciated. here is my code::::

[ February 07, 2005: Message edited by: Sean Magee ]
[ February 07, 2005: Message edited by: Sean Magee ]

Jeroen Wenting
Ranch Hand
Posts: 5093
you have an array of ints.
Each int is the number of asterisks you need to print on the corresponding line...

Joel McNary
Bartender
Posts: 1840
Looks like a job for nested loops!

in Pseudo-code:

for each element in the results array
for 1 to element.value
print an asterisk
next
print a new line
next