Reflection?

This is a discussion on Reflection? within the C++ Programming forums, part of the General Programming Boards category; Hey guys! I'm new to the board and I have a question. For the particular problem, it looks like I ...

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

    Reflection?

    Hey guys! I'm new to the board and I have a question. For the particular problem, it looks like I have to find out how to reflect the following pattern. I understand how to produce the pattern, but not the reflection of it. Any help would be appreciated.

    int i, n;
    for (i=1; i <=10; i++)
    {
    for (n=1; n<=i; n++)
    cout << '*';
    cout << endl;
    }
    Using that fragment how would I get the reflection of it?


    Thanks

  2. #2
    The Defective GRAPE Lurker's Avatar
    Join Date
    Feb 2003
    Posts
    949
    Reflect it so it would look like this:

    Code:
             *
            **
           ***
          ****
         *****
        ******
       *******
      ********
     *********
    **********
    ? is that what you mean?

    If so, think about it. The first line has 9 spaces (hmm...1 less than total amount of lines!) followed by an asterisk. The next has 8 and 2 asterisks. The next: 7 spaces, 3 asterisks. Try to follow that pattern.
    Last edited by Lurker; 05-08-2004 at 12:57 PM.
    Do not make direct eye contact with me.

  3. #3
    Registered User
    Join Date
    May 2004
    Posts
    3
    Yeah, that's the way it should look. I sorta see what your talking about. I'm not sure though how to do it. (Forgive me, I've only been taking C++ for a short time now )

  4. #4
    wierd guy bart's Avatar
    Join Date
    Aug 2001
    Posts
    87
    Ok, there's always 10 characters. you store the amount of asterisks. so, for each line print 10-[amount of asterisks] spaces, followed by [amount of asterixes] asterisks.

  5. #5
    Registered User
    Join Date
    May 2004
    Posts
    3
    OK I see. thanks.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. iterate through types in a library (reflection)
    By bling in forum C++ Programming
    Replies: 1
    Last Post: 10-29-2008, 05:15 PM
  2. OpenGL: How to make surface shiny
    By ting in forum Game Programming
    Replies: 6
    Last Post: 06-18-2008, 05:09 PM
  3. Two basic questions about reflection
    By George2 in forum C# Programming
    Replies: 0
    Last Post: 06-01-2008, 08:52 PM
  4. Loading a DLL file
    By Mavix in forum C# Programming
    Replies: 2
    Last Post: 09-14-2007, 02:05 PM
  5. GL_CLIP_PLANE not working
    By joeprogrammer in forum Game Programming
    Replies: 2
    Last Post: 03-27-2006, 10:52 AM

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