Re: Program help

From: John Harrison (john_andronicus_at_hotmail.com)
Date: 09/15/04


Date: Wed, 15 Sep 2004 06:53:24 +0100


"Josh" <tool540@yahoo.com> wrote in message
news:3b2ebc2c.0409141950.20d807d4@posting.google.com...
> Howdy
> i am newb somewhat to programing and i was just for fun trying to
> compile a program that asks the user for an odd int less than 22 and
> then returns this
> *****************
> ******* *********
> ****** ********
> ***** *******
> etc. the first line reps. the number enterd by user
> but i am having trouble i can get the first line but am having trouble
> making the white space in the middle i am using a nested loop. Should
> i use arrays?

No

> Any help would help thanks
> Josh

You need several loops. At the highest level you have a loop, each time
round that loop you print an single line. Within that loop you have a
sequence of three loops. The first prints the first block of *, the second
prints the block of spaces, the third prints the second block of *.
Something like this

// print lines
for (...)
{
    // print first *'s
    for (...)
    {
    }
    // print spaces
    for (...)
    {
    }
    // print second *'s
    for (...)
    {
    }
}

john



Relevant Pages

  • Re: vb.net statement/reference list
    ... I have been working with Access for 8 years now and decide to switch to do programing in VB.NET. ... I used a lot of VBA with Access such msgbox(), loop, etc.. ...
    (microsoft.public.dotnet.languages.vb)
  • vb.net statement/reference list
    ... decide to switch to do programing in VB.NET. ... I used a lot of VBA with Access such msgbox(), loop, etc.. ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Question about For/Next loops
    ... The reason for clarifying the next in a for next loop is when ... If you had thirty lines of code and a second "for next" loop somewhere in ... Dim cnn As ADODB.Connection: ... (And White space is probably the most useful tool in any readiblity ...
    (microsoft.public.vb.enterprise)
  • Re: Testing strings for characters?
    ... >> Private Function TrimEx(ByVal sText As String) As String ... > loop will do that ... Function ReduceWhiteSpaces(ByVal StrIn As String) As Long ... Here I treat only tabs and blanks as white space. ...
    (microsoft.public.vb.general.discussion)
  • Re: Bash script for files with spaces in the filenames
    ... jvian10@xxxxxxxxxxx (Jeff Vian) writes: ... In the above construct $file gets the first part up to the delimiter ... Just replace the for loop by a while loop: ...
    (Fedora)