Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Register Tags Active Topics RSS Search Mark Forums Read

Sponsored Links



Want To Print Triangle In C++

Software Development


Reply
 
Thread Tools Search this Thread
  #1  
Old 08-01-2009
Member
 
Join Date: Dec 2008
Posts: 371
Want To Print Triangle In C++
  

hi,
is there any way to print triangle in c++ like this :

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

Reply With Quote
  #2  
Old 08-01-2009
Member
 
Join Date: May 2008
Posts: 2,007
Re: Want To Print Triangle In C++

hi,
try this program this will print the output in traingle of '*' from left to right.
do the same thing to print '*' traingle from right to left just inverse the loop.
Code:
# include <iostream>
#include <conio.h>
int printStars (int f,int g,int h);
int main ()
{
	printStars(f, g, h);
	return 0;
}

int printStars (int f,int g,int h)
{
	int f, g, h;

	for (f=1; f<=5; f++)
	{
		for (h= 4; h >=0; h--)
		{
			cout<<" ";
			while (g=0)
			{
			for (g=1; g<=lines; g++)
			}
			
			{
				cout<<"* ";
			}
			
		           }
	                      cout<<endl;
	                      }}
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "Want To Print Triangle In C++"
Thread Thread Starter Forum Replies Last Post
Need C program to print triangle of character or number Khan Baba Software Development 5 17-09-2011 04:40 PM
Triangle generator gelsys1208 Software Development 3 13-10-2010 04:32 AM
What is the Code for Floyd's triangle in C ?? Silent~Kid Software Development 5 02-01-2010 06:43 PM
Triangle using C++ Brake Fail Software Development 4 04-02-2009 10:54 PM
Print spooler hangs when trying to print from a shared print Jisbomb Windows XP Support 3 27-07-2007 10:17 PM


All times are GMT +5.5. The time now is 12:03 PM.