Guys I need some help...

This is my program...

#include<iostream>
using namespace std;
int main()


#include<iostream>
using namespace std;
int main()
{
    int a=1;
    int b=5;
    cout<<"*";
    cin>>a;

    while <a=>5>;
{
    cout<<"*"; 
    ++a
}
    return 0;
}
{

And this will be the output of my program.
*
**
***
****
*****

By the way I'm using while looping..
Hope that you could help me..

Recommended Answers

All 4 Replies

Your while loop on line 10 is incorrect. It should be while (a>=5) instead of while <a=>5>; Also, you have an extraneous { at the end of your code.

Is it somehow possible to tell us with what exactly you need help?
For example the variable b never gets used, the while looks a bit strange etc. but as long as you don't explain more, we can do little but guess what the solution might be.

Check your logic up.
Use this to get the idea...

#include <iostream>
using namespace std;


int main()
{
    bool ff = true;
    short tt;
    short count=1;

  while(ff){

      for(tt = 0 ; tt < count ; tt++){
          std::cout <<"*";
      }

      count +=5;
      std::cout<<endl;
      if(tt >= 50){
          ff= false;
      }
  }


   return 0;
}

it's code

include <iostream>
using namespace std;

int i , j;

int lp = 6; //<<= change number 2,3,4,5,6...more

for ( i=1; i<lp; i++ )
{
    for ( j=0; j<i; j++ )
    {
        cout << "*";
    }
    cout << endl;
}
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.