cout/printf dont displaying correct output

Nov 1, 2010 at 12:57am
hi im trying to solve a problem that requires to displays asteric per 100 but my function doesnt display nothing

1
2
3
4
5
6
void displayStars(int star)
{
	for (int counter=0; counter>star; counter+100) {
	printf("*");
	}
}


when I compile my code it skips this out and doesnt display any stars like id like it to
Last edited on Nov 1, 2010 at 12:57am
Nov 1, 2010 at 1:00am
The middle part of the for loop is a condition for which the loop continues when it is true.
counter+100 effectively does nothing - it adds 100 to counter and discards the result.
Last edited on Nov 1, 2010 at 1:01am
Nov 1, 2010 at 1:10am
Thanks I got it working
Topic archived. No new replies allowed.