View Single Post
Join Date: Feb 2008
Posts: 67
Reputation: c++noobie is an unknown quantity at this point 
Solved Threads: 1
c++noobie c++noobie is offline Offline
Junior Poster in Training

Re: for and while HELP

 
0
  #7
Jan 7th, 2009
Use for loops to print the stars, the spaces, etc. The standard for loop structure is one of the following two

for( int i = 0; i < numberOfTimes; i++ )
for( int i = 1; i <= numberOfTimes; i++ )

for loop number of lines
{
for loop spaces
{
print space
}
for loop stars
{
print star, print space
}
print newline
}
}

Edit:
BTW, the number of spaces to print is equal to the TotalNumberOfLines - CurrentLineNumber
The number of stars to print is equal to the CurrentLineNumber
Last edited by c++noobie; Jan 7th, 2009 at 3:00 am.
Reply With Quote