give me an idea please

Oct 6, 2010 at 2:51pm
i dont know already this king of topic beacause my instructor is always absent

print a pyramid read a number and print a pyramid that has that size
example if number=5
output:



*
* *
* * *
* * * *
* * * * *

5 stars

i need it before octber 8 come it will help me a lot if you answer this thank you!
Last edited on Oct 6, 2010 at 2:52pm
Oct 6, 2010 at 3:11pm
Funny... we get of lot like these... anyways!

You'll want to nest two for loops, like
1
2
3
4
5
6
7
8
for(int i = 0; i < limit; i++)
{
    for(int j = 0; j < otherLimit; j++)
    {
        //Do stuff.
    }
    //Do stuff.
};


Does this help you a bit too much?

-Albatross
Oct 6, 2010 at 3:21pm
oh sory i dont have any idea because its our project and my instructor given to us without any discussion can i have more question ? anywayss thank you dude :))
Oct 6, 2010 at 3:24pm
Since I'm in a generous mood, I'll also state that the inner //Do stuff is to print "* " and that the outer one is to print a new line. You won't get any more help from me, though; I practically gave you the solution (although I did not state what otherLimit is. You'll have to work that out!).

-Albatross
Last edited on Oct 6, 2010 at 3:24pm
Oct 6, 2010 at 3:27pm
i know but ............(stuck up) last one please for the sake of my project ?
Oct 6, 2010 at 3:36pm
hey all i need s the required output , available input, then processing requirements
Oct 6, 2010 at 3:40pm
for (int i=1;i<=number;i++)cout << string(i,'*') << endl;
But you're probably not supposed to use std::string for this assignment.
Last edited on Oct 6, 2010 at 3:41pm
Oct 6, 2010 at 3:44pm
Oh... wait... all you want to know is what the program should take in and also what it should output?
If so... /desk my bad.

It should take in one positive integer (their example had 5), and output a triangle that has a base with that many stars.


Examples:
Enter a positive integer:
3

*
* *
* * * 
Enter a positive integer:
7

*
* *
* * * 
* * * *
* * * * *
* * * * * *
* * * * * * *
Enter a positive integer:
-1





-Albatross



Oct 6, 2010 at 3:47pm
project not an assignments ! also algorithm tnx a lot you make me smile :)
Oct 6, 2010 at 3:57pm
print a rectangle outline , Read a height and width and print a rectangle that look like the one below.

a. break it down into three problems: a line of stars, line consistingof a star, blanks, and again a line of stars.
b. at each position write either a star blank. use an if statement to test for first or last rows of first or last columns in which case a star is printed, otherwise print a blank

Ex: * * * * * * * * * *
* *
* * } height= 5
* *
* * * * * * * * * *
Oct 6, 2010 at 9:54pm
Perhaps it would be easier if one of us just took the class for you???

... At least show us some effort!
Oct 6, 2010 at 9:58pm
... Or just try that search box at the top of the page!
Topic archived. No new replies allowed.