HELP! need someones expertise

This is a discussion on HELP! need someones expertise within the C++ Programming forums, part of the General Programming Boards category; hi guys, im a complete noob and am in need of your assistance. I'm trying to figure out how write ...

  1. #1
    Registered User
    Join Date
    May 2004
    Posts
    4

    HELP! need someones expertise

    hi guys, im a complete noob and am in need of your assistance. I'm trying to figure out how write a program that gives you this as a result:

    *
    **
    ***
    ****
    *****
    ******
    *******
    ********
    *********
    **********
    ***********
    ************
    *************
    **************
    ***************
    *********************
    **********************
    *********************
    ***************
    **************
    *************
    ************
    ***********
    **********
    *********
    ********
    *******
    ******
    *****
    ****
    ***
    **
    *
    can someone help me out?! I am writing this with metrowerks code warrior. Thank you for your help. (simplest program would be best)

  2. #2
    Registered User
    Join Date
    May 2004
    Posts
    4
    by the way, i would try and figure this out on my own, but i am in the city with my laptop and dont have my books or resources to use.

  3. #3
    Registered User
    Join Date
    Apr 2004
    Posts
    100
    Well, you could just do line after line of "cout<<....", and there ya go.

  4. #4
    Registered User
    Join Date
    May 2004
    Posts
    4
    is there any way to do with with a loop?

  5. #5
    Registered User
    Join Date
    May 2004
    Posts
    16
    yer just use a steady increment, make sure the loop knows about it mind.

  6. #6
    Registered User
    Join Date
    May 2004
    Posts
    4
    How can I get this to start each asterics four spaces to the left:
    example:
    *
    **
    *** (not like this)

    *
    **
    *** (like this)



    /*
    title: theWedge.cpp
    description: illustrates the for instruction
    */
    #include <iostream>
    using namespace std;

    int main( )
    {
    int J, K, rowCount;

    cout << "Enter Row Size: ";
    cin >> rowCount;

    for(K = 0 ; K < rowCount ; K++) {
    for(J = 0 ; J < K ; J++)
    cout << "*";
    cout << endl;
    }

    }

  7. #7
    Registered User ventolin's Avatar
    Join Date
    Jan 2004
    Posts
    92
    try this out, much of it is hardcoded and ill leave the input stuff for you to do/play around with, ive used VC++ as i dont have your compiler, but it should work

    Code:
    #include <iostream>
    
    using namespace std;
    
    int main()
    {
    	int levels = 15;
    	int mid = 22;
    	int k =0;
    
    	for(int i = 0; i < mid; i++)
    	{
    		for(int j = 0; j < i; j++)
    		{
    				cout << "*";
    		}
    
    		if(i > levels)
    		{
    			if(i > 19)
    			{
    				for( k = 0; k < i; k++)
    				{
    					cout << "*";
    				}
    			}
    		}
    	}
    	
    	for(i = mid; i > 0; i--)
    	{
    		for(int j = 0; j < i; j++)
    		{
    				cout << "*";
    		}
    
    		if(i > levels)
    		{
    			if(i > 19)
    			{
    				for( k = 0; k < i; k++)
    				{
    					cout << "*";
    				}
    			}
    		}
    	}
    	return 0;
    }

  8. #8
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,607

  9. #9
    Registered User ventolin's Avatar
    Join Date
    Jan 2004
    Posts
    92
    sorry i was bored

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Need someones help
    By Tyguy2354 in forum C++ Programming
    Replies: 3
    Last Post: 10-07-2005, 05:24 AM
  2. Can you steal someones code ?
    By joeyzt in forum Game Programming
    Replies: 5
    Last Post: 06-28-2003, 08:14 PM
  3. Someone's using "CrystalSky"
    By Series X4 1.0 in forum A Brief History of Cprogramming.com
    Replies: 2
    Last Post: 07-20-2002, 01:23 PM
  4. This dude need someones help, bad????
    By correlcj in forum C Programming
    Replies: 9
    Last Post: 07-12-2002, 09:28 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21