give me an idea please

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
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
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 :))
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
i know but ............(stuck up) last one please for the sake of my project ?
hey all i need s the required output , available input, then processing requirements
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
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



project not an assignments ! also algorithm tnx a lot you make me smile :)
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
* *
* * * * * * * * * *
Perhaps it would be easier if one of us just took the class for you???

... At least show us some effort!
... Or just try that search box at the top of the page!
Topic archived. No new replies allowed.