CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Sep 2010
    Posts
    1

    Loop Help Please

    For comp sci class, we have to make a program. For one part of the program it requires you use "*", to make the y-axis of a graph. The teacher wrote on the board how to do it, but I can't remember what he did. So for that part of the program, you have to use loops to make it. I want the code to do this.
    Ex:
    *
    *
    *
    *
    *
    *
    *

    // The "Lol" class.
    import java.awt.*;
    import hsa.Console;

    public class Lol
    {
    static Console c; // The output console

    public static void main (String[] args)
    {
    c = new Console ();
    for (int k=1; k<10; k++)
    {c.setCursor (10-k,0);
    c.println ("*");
    }
    // Place your program here. 'c' is the output console
    } // main method
    } // Lol class







    This is what I tried, but when I run it nothing happens. The screen is just blank. So I just want to know what I have to fix to make the loop work. The loop has to make a certain amount "*".

    Please and thank you.

  2. #2
    Join Date
    Jun 1999
    Location
    Eastern Florida
    Posts
    3,877

    Re: Loop Help Please

    Norm

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