# Thread: Major Beginner looking for simple pointers

1. ## Major Beginner looking for simple pointers

I just started my C++ programming class and I am having trouble. I understnd what the book says but not how to use it.
I have a program that allows the user to specify the number of lines in a tree of X's and asks if they would like to repeat. The part that I am having trouble with is that while the tree is 30 lines long, if the user enters a number larger than 30 I need to have the program default to 30 lines and then print the tree of 30 lines. If anyone could maybe point me in the right direction I would sure appreciate it. If you need more specifics let me know. Thank you soooo much.....Peace

2. ## well...

if( lines > 30 )
{
lines = 30;
}

If you would like some lessons in C++ and logic, just email .

SPH

3. ## Re: well...

Originally posted by minime6696

if( lines > 30 )
{
lines = 30;
}

If you would like some lessons in C++ and logic, just email .

SPH
Leave out the braces if you want:

Code:
```if (lines > 30)
lines = 30;```

4. Thank you both for the answers. I'm going to post the code that I have so far. I have no idea what's going on. A friend of mine wrote it for me. So maybe you could help me a bit.
minime6696-----if you are serious I would love to take you up on your offer.Thank you....
Here's what I have...#include <iostream>
#include <conio.h>

using namespace std;

int main (void)
{
int line, n, w;
char rep = 'y';
while(rep == 'y' || rep == 'Y')
{
cout<<"Enter number of lines."<<endl;
cout<<"(1 through 30)"<<endl;
cin>>line;
if(line<=30 && line >=0)
{
for(w = 0; w < line; w ++)
{ for(n=30; n>w ; n--) {
cout<<" "; }
for(n=0 ; n<w*2+1 ; n++)
{
cout<<"x";
}
cout << endl;
}
}
else
cout <<"Default to 30 lines."<<endl;
cout << "Repeat? Y to repeat."<< endl;
cin >> rep;

}
cout<<"Press any key to exit."<<endl;

getch();
return 0;
}
Sorry it's long, and rememeber I am just starting out at this programming mumbo jumbo...Thanks again...Peace

5. ## im sierious

My aim handle (wierd as it is) is:

aGaBoOgAmOnGeR - Add me to AIM and I will give you some lessons... oh yes and wut compiler do u have?

SPH