hello all . well its pretty simple but i need to get this for loop sorted before i can move on.

#include <iostream.h>

void square();
void circle();
void arrow();
void diamond();

using std::cout;
using std::endl;

void square()
{
  //first line
  for (int e = 1; e >= 9; e++)
  {
   cout << "*";
  }

}


int main()
{
  square();
  return 0;
}

so thats it .. and it wont print the stars . if i comment out the loop then it will display a star. so i dont know whats going on i cant see any error in the syntax or logic. so any help is appreciated thank you.

In the "for", you stated the following:
e=1; e>=9; e++
So, it means that e is first 1 and it will grow each cycle while e>=9 (simply isn't possible-e=1). To correct this, just make the for like this:

for (e=1;e<=9;e++) ...

ah thank you .. got it the wrong way round thank you!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.