CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4

Threaded View

  1. #1
    Join Date
    Feb 2011
    Posts
    5

    Red face Help with printing stars

    hey, I can't get this program working;
    public class Uppgift2 {



    static void main(String[] args) {
    System.out.println("My Star Triangle");
    printChar('+', 16);
    System.out.println();
    for (int i = 0; i < 16; i++) {
    printChar(i, 16 - i);
    System.out.println();
    }

    }


    static void printChar (int start, int width){
    for (int i = 0; i<bredd; i++){
    printStars(' ', start);
    printStars('*', width);
    System.out.println(" ");


    }

    return;



    }
    static void printStars(char Stars, int number){

    for(int i = 0; i<number; i++){

    System.out.print(Stars);
    }

    }
    }

    No errors are visible but nothing comes up in the console. I want the stars to have the formation like this:
    My Star Triangle
    ++++++++++++++++
    ****************
    **************
    ************
    **********
    ********
    ******
    ****
    **
    the triangle is meant to be symetric on both sides, like an upside-down pyramid.
    (I would appreicate if anyone could help me out here)
    best regards Emil
    Last edited by NeWoX; February 21st, 2011 at 07:11 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured