Welcome to Dream.In.Code
Getting C++ Help is Easy!

Join 136,836 C++ Programmers for FREE! Get instant access to thousands of C++ experts, tutorials, code snippets, and more! There are 1,623 people online right now. Registration is fast and FREE... Join Now!




making right triangles

 
Reply to this topicStart new topic

making right triangles, C++ program, Hey guys.. please help me

kurorokhristoffer
3 Oct, 2008 - 07:04 PM
Post #1

New D.I.C Head
*

Joined: 3 Oct, 2008
Posts: 3

Hi, im confuse making this program,.. i need a little help from expert here in dream in code so i decided to post it in here,..


Write a program that uses for statements to print the following patterns separately, one below the other. Use for loops to generate the patterns. All asterisks (*) should be printed by a single statement of the form cout << '*'; (this causes the asterisks to print side by side). [Hint: The last two patterns require that each line begin with an appropriate number of blanks. Extra credit: Combine your code from the four separate problems into a single program that prints all four patterns side by side by making clever use of nested for loops.]

1.

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

2.

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

3.

**********
..*********
....********
......*******
........******
......... *****
............****
..............***
................**
..................*

4.

...................*
.................**
...............***
.............****
...........*****
.........******
.......*******
.....********
...*********
.**********

I already made 1 and 2 .. my problem is figure number 3 and 4, please help me using c++..(nevermind the dots in 3 and 4)
Here is the code i made so far in 1 and 2, i need 3 and 4 thanks i really appreciate your help...
CODE

#include<iostream>
using namespace std;
int main()
{
    int value = 11;
    for(int i = (value - 1); i > 0; i--)
{
for(int j = 0; j < i; j++)
cout << "*" << flush;

cout << "" << endl;
}
return 0;
}




A little help is a million thanks.....

This post has been edited by kurorokhristoffer: 3 Oct, 2008 - 07:38 PM
User is offlineProfile CardPM
+Quote Post

Jayman
RE: Making Right Triangles
3 Oct, 2008 - 07:15 PM
Post #2

Student of Life
Group Icon

Joined: 26 Dec, 2005
Posts: 6,957



Thanked: 43 times
Dream Kudos: 500
Expert In: C#, VB.NET, Java

My Contributions
Dream.In.Code has a policy by which we prefer to see a good faith effort on your part before providing source code for homework assignments. Please post the code you have written in an effort to resolve the problem, and our members would be happy to provide some guidance. Be sure to include a description of any errors you are encountering as well.

Please post like this:

Thank you for helping us helping you.
User is online!Profile CardPM
+Quote Post

kurorokhristoffer
RE: Making Right Triangles
4 Oct, 2008 - 12:08 AM
Post #3

New D.I.C Head
*

Joined: 3 Oct, 2008
Posts: 3

QUOTE(jayman9 @ 3 Oct, 2008 - 08:15 PM) *

Dream.In.Code has a policy by which we prefer to see a good faith effort on your part before providing source code for homework assignments. Please post the code you have written in an effort to resolve the problem, and our members would be happy to provide some guidance. Be sure to include a description of any errors you are encountering as well.

Please post like this:

Thank you for helping us helping you.

Please help me T_T ....


User is offlineProfile CardPM
+Quote Post

Sadaiy
RE: Making Right Triangles
4 Oct, 2008 - 09:27 AM
Post #4

New D.I.C Head
*

Joined: 3 Oct, 2008
Posts: 38



Thanked: 1 times
My Contributions
here is code for #3, #4 is almost the same...


cpp

for(int i = 9; i>= 0; --i)
{
for(int x = 0; x < 9-i; ++x)
cout << ".";
for(int j = 0; j <= i; j++)
cout << "*";
cout << endl;
}

User is offlineProfile CardPM
+Quote Post

Reply to this topicStart new topic
Time is now: 12/3/08 04:19PM

Live C++ Help!

C++ Tutorials

Reference Sheets

C++ Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month