I need to do two programs and I am unsure of what to do with them.  If
anyone could help me with the code or the steps necessary to write the
programs it would be greatly appreciated.  Thank you.  Here's what I
need to do:

First program: A program that reads a char. from "A" to "Z" as input
to produce output in the shape of a pyramid composed of the letters up
to and including the letter that is input.  Example:
A
ABA
ABCBA
ABCDCBA
Second program: Program that imlements a game in which first user
enters distance to a target.  The user then enters the angle and
velocity for launching the projectile.  If the projectile comes within
0.1% of the distance to the target, the user wins the game.  If
projectile doesn't come close enough, the user is told how far off the
projectile is, and is allowed to try again.  Afetr five tries with no
winning input the user loses the game.  Angle inputted should be in
degrees.  Related formulas:

Distance=Sqr(Velocity) * Sin(2 * Angle)/32.2

Any help would be greatly appreciated.  Thanks!

##### Quote
In article <4ksc0q\$...@server.cntfl.com> LostCoz wrote:
>I need to do two programs and I am unsure of what to do with them.  If
>anyone could help me with the code or the steps necessary to write the
>programs it would be greatly appreciated.  Thank you.  Here's what I
>need to do:

>First program: A program that reads a char. from "A" to "Z" as input
>to produce output in the shape of a pyramid composed of the letters up
>to and including the letter that is input.  Example:
>                                       A
>                                      ABA
>                                     ABCBA
>                                    ABCDCBA

I adjusted the example so it would look right with a fix pitch font.

I can probably find a dozen ways to do this.  Can't you think of even
one?  Have you looked at your example and thought about the steps you
would take to do it?  This type of problem is ideal for recursion.  And
anything that can be done recursively can be done iteratively.

Let's look at an iterative solution first.  Look at the top line.
Compare it with the next line.  Can you explain the difference?  Compare
the second and third lines.  Can you explain the difference?  Can you
explain the difference so that your explanation can be used for the
first and second, second and third, third and fourth, etc.?

By your definition, all pyramids will begin with an A.  So I would start
by building a string containing an "A".  Then I would print the string.
I would then insert the center character into the center of the string.
I would then insert a character that was one greater than the center
character at the center of the string.  If this new character was not
greater than the ending character I would print this string and
construct a new string. I'm going to let you figure out how to locate
the center of the strings and to center the lines on the screen.  :-)

A recursive solution can be setup to solve the problem from the top
down, or from the bottom up.  Since the iterative solution already
solved the problem from the top down, let's look at doing it from the
bottom up.  I would start by building a string that contained characters
from "A" to the ending character and from the ending character less one
down to "A".  I would then pass this string to a recursive routine.  The
recursive routine would return if the string was empty, otherwise it
would make a copy of the string, remove two characters from the center
of the copied string and call itself with the newly constructed string.
It would then write the original copy of the string that it received.

##### Quote
>Second program: Program that imlements a game in which first user
>enters distance to a target.  The user then enters the angle and
>velocity for launching the projectile.  If the projectile comes within
>0.1% of the distance to the target, the user wins the game.  If
>projectile doesn't come close enough, the user is told how far off the
>projectile is, and is allowed to try again.  After five tries with no
>winning input the user loses the game.  Angle inputted should be in
>degrees.  Related formulas:

>Distance=Sqr(Velocity) * Sin(2 * Angle)/32.2

>Any help would be greatly appreciated.  Thanks!

Programs of this nature are designed to get you to think.  The task was
chosen to be something that you yourself could easily do without having
to do a lot of research.  The idea is for you to "think" of how you
would do it.  Then write an outline of the steps you would take, and
finally to translate these steps into a programming language.  I could
write the above steps in more of an outline or pseudo coded style, but
the more that is done for you, the less you will learn.  So I purposely
left it a little more difficult to understand than I would have if I had
been writing it for myself.

I'm going to leave the second problem for you to think about.  Remember,
program it on paper using your native language.  Write the instructions
that tell _you_ how to solve the problem.  If you can't do it how do you
expect to teach a machine with the IQ of a rock how to do it?

Let me know how you make out.

...red

Knowledge is one of the few things that you
can give away and still keep for yourself.

In article <4ksc0q\$...@server.cntfl.com>, rped...@nxus.com says...

##### Quote

>I need to do two programs and I am unsure of what to do with them.  If
>anyone could help me with the code or the steps necessary to write the
>programs it would be greatly appreciated.  Thank you.  Here's what I
>need to do:

>First program: A program that reads a char. from "A" to "Z" as input
>to produce output in the shape of a pyramid composed of the letters up
>to and including the letter that is input.  Example:
>                                            A
>                                         ABA
>                                      ABCBA
>                                    ABCDCBA
>Second program: Program that imlements a game in which first user
>enters distance to a target.  The user then enters the angle and
>velocity for launching the projectile.  If the projectile comes within
>0.1% of the distance to the target, the user wins the game.  If
>projectile doesn't come close enough, the user is told how far off the
>projectile is, and is allowed to try again.  Afetr five tries with no
>winning input the user loses the game.  Angle inputted should be in
>degrees.  Related formulas:

>Distance=Sqr(Velocity) * Sin(2 * Angle)/32.2

>Any help would be greatly appreciated.  Thanks!

Sounds like your homework to me...

Instead of saying, "What do I do?", try the problems yourself and THEN
if your really stuck, post here...  You'll learn MUCH more if you try to
figure it out on your own first...

Jeff

--
___________________________________________________________________
-->  J E F F   W E N T W O R T H <---                |
((((((((((((((((((   eMail: bj...@torfree.net   )))))))))))))))))  |
|
"It's easy to stop making mistakes.  Just stop having ideas."    |
-- UNKNOWN                           |
___________________________________________________________________|