0

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..

Edited by Dani: Formatting fixed

5
Contributors
4
Replies
39
Views
2 Years
Discussion Span
Last Post by dbfud1988
0

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.

Edited by rubberman

0

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.

0

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;
}
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;
}

Edited by dbfud1988

Attachments
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.