need some help in a program

DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: need some help in a program

  1. #1
    Join Date
    Feb 2006

    need some help in a program

    hi, i need some help in a program which has to be in C++ languge: the program is to draw a pyramid of stats (*), only the front of it that the user will input the number of lines of the stars. how do i wright the sentix of such a program!!!

  2. #2
    Join Date
    Feb 2006
    This is an optional solution:

    #include <iostream>
    using namespace std;
    int main()
    	int row;
    	int startrow;
    	int num;
    	int counter;
    	cout << "Give the number of rows of the pyramid:" << endl;
        cin >> row;
    	counter = 1;
        for(startrow = row; row>0;--row)
    		//Drawing blancs
    			cout << " " ;
    		//Drawing stars
    		for(num=(counter*2)-1; num > 0;num--)
    			cout << "*";
    		cout << endl;		
    	return 0;
    Hope this helps.


Similar Threads

  1. Help with a program
    By stormswimmer in forum Java
    Replies: 2
    Last Post: 01-02-2006, 03:17 PM
  2. problem in program in c++
    By mheasen in forum Architecture and Design
    Replies: 0
    Last Post: 03-20-2002, 09:24 AM
  3. Please help with running executable vb program.
    By Gordon Reichhardt in forum VB Classic
    Replies: 2
    Last Post: 01-08-2002, 10:06 AM
  4. How can I build copy protection into my program
    By W.Pierce in forum VB Classic
    Replies: 1
    Last Post: 12-11-2001, 08:28 AM
  5. Replies: 0
    Last Post: 12-15-2000, 10:07 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
Latest Articles
Questions? Contact us.
Web Development
Latest Tips
Open Source

   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center