Results 1 to 2 of 2

Thread: Want To Print Triangle In C++

  1. #1
    Join Date
    Dec 2008
    Posts
    371

    Want To Print Triangle In C++

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

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

  2. #2
    Join Date
    May 2008
    Posts
    2,012

    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;
    	                      }}

Similar Threads

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

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,711,677,690.69981 seconds with 17 queries