All things are lawful, but not all things are profitable.
Knute Snortum wrote:Think about line 10. What would you do to the index to get the next letter?
Knute Snortum wrote:Think about line 10. What would you do to the index to get the next letter?
All things are lawful, but not all things are profitable.
Knute Snortum wrote:How about using a different index for arrays?
All things are lawful, but not all things are profitable.
Knute Snortum wrote:How about creating a whole new index just for advancing the letters?
All things are lawful, but not all things are profitable.
Knute Snortum wrote:Not a loop, just another index.
L Johnson wrote:
Knute Snortum wrote:Not a loop, just another index.
Sorry I'm probably a burden but I'm trying so here's how I'm currently interpretting the situation you're telling me to create a whole new variable and do a counter? Because I'm not understanding on creating a new index. Thank you for helping by the way and not just giving the answer.
All things are lawful, but not all things are profitable.
Junilu Lacar wrote:Sometimes when one approach isn't working, it helps to take a different tack. You don't have to solve this all at once. You can easily solve your problem of wanting to output the letters consecutively. Don't worry about the formatting for now, just get the letters to be printed in the order you want them. Try printing them all on one line first. Then try to print each letter on a different line.
Once you have that done, think about where you want to start a new line. Again, don't worry about forming a triangle just yet. Just think of outputting the correct number of letters per line.
So the progression would look something like this:
First cut (all in one row):
A B C E D F G ... X Y Z
Second cut (one letter per line):
A
B
C
D
E
...
X
Y
Z
Third cut (correct # letters per line):
A
B C
D E F
G H I J
K L M N O
...
Fourth cut (form a pyramid):
...
Do you think you can at least try to do the first and second cuts?
L Johnson wrote:3rd step:
unsure how you made the pyramid without a for loop
Junilu Lacar wrote:
L Johnson wrote:3rd step:
unsure how you made the pyramid without a for loop
You misunderstood me. I didn't say you can create the pyramid without a for-loop. You have to take what you did in the first and second cut and apply what you learned about keeping letters on the same line and starting a new line of letters. There's a slight difference in the statements you use to do one vs. the other right? So when outputting letters for the pyramid, you have a combination of printing some letters on the same line and other letters starting on a different line, right? So, you still need a for loop. This is where you go back to Knute's previous suggestions. See how you can use his tips and what you've done so far in the first and second cut. The combination of those things will let you print the pattern that looks like this:
A
B C
D E F
G H I J
K L M N O
...
Junilu Lacar wrote:Don't think that choosing proper names in your programs is a trivial thing. Some of the best programmers in the world have said that the two hardest things in programming are: 1. Cache invalidation, 2. Choosing good names, and 3. Off-by-one errors. By far, #2 in that list is the hardest of them all.
L Johnson wrote:Im sorry that me choosing the names were annoying you lol this was just a small sample of what I have to do for my self learn. Ill change the name of the array
You are not annoying us. Come back in six months and try to read your code, and then you will find out why good names are important.L Johnson wrote:. . . choosing the names were annoying you . . .
L Johnson wrote:I currently have:I can feel like Im going in the right direction but can you tell me what I am doing wrong I did store the values.
This tiny ad is guaranteed to be gluten free.
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
|