Re: Program help
From: John Harrison (john_andronicus_at_hotmail.com)
Date: 09/15/04
- Next message: John Harrison: "Re: Passing an array to a function using a constant/variable"
- Previous message: David Hilsee: "Re: Program help"
- In reply to: Josh: "Program help"
- Next in thread: Karl Heinz Buchegger: "Re: Program help"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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
- Next message: John Harrison: "Re: Passing an array to a function using a constant/variable"
- Previous message: David Hilsee: "Re: Program help"
- In reply to: Josh: "Program help"
- Next in thread: Karl Heinz Buchegger: "Re: Program help"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|