PDA

Click to See Complete Forum and Search --> : How would you do this.


Help
Mar 9th, 2001, 09:12 AM
This is post at www.cprogramming.com and noone seemed to get it. I was just curious if any of you could write down code that could do this.

{
It seems as if no one out their can help me, but I think it may be my fault for not explaining this program clearly. So I will take one more shot at this. Here goes!
what I need is this: (I already have the right side, I just need help on getting the left side). Thanks.
The exact post is http://www.cprogramming.com/cgi-bin/UltraBoard/UltraBoard.pl?Action=ShowPost&Board=c_general&Post=4853&Idle=7&Sort=0&Order=Descend&Page=0&Session=

a
ab
abc
abcd
abcde
abcdef
abcdefg
abcdefgh
ihgfedcbabcdefghi
jihgfedcbabcdefghij
kjihgfedcbabcdefghijk
etc,etc...}

Technocrat
Mar 9th, 2001, 10:20 AM
First of all my experience with that board has been bad. I think there is like 5 people that have any IQ on that board. Anyway......

Your link is broke, so I have no idea what your question is. Can you fix the link, or retry your question.

Help
Mar 9th, 2001, 10:32 AM
hmm, link works fine for me.

I would have to agree, my experience there has also been bad.

Technocrat
Mar 9th, 2001, 10:51 AM
Yeah the link worked this time, but I still dont understand what your question is.
Are you trying to get a print out lined up like that?
Are you trying to get letters like that?
I dont understand what you are after

KingDavid
Mar 14th, 2001, 03:41 PM
This what you mean?

#include <iostream.h>

void main()
{
int l; // letter
int n; // letter to count to

for(n = 1; n <= 26; n++)
{
// set l to the current letter
for(l = n; l >= 1; l--)
{
cout << (char)(96 + l);
}
// now start from a to n
for(l = 1; l <= n; l++)
{
if((96 + l) != 97)// don't repeat a
cout << (char)(96 + l);
}
cout << endl;
l = 1;
}
cout << endl;
}

// output
/*
dcbabcd
edcbabcde
fedcbabcdef
gfedcbabcdefg
hgfedcbabcdefgh
ihgfedcbabcdefghi
jihgfedcbabcdefghij
kjihgfedcbabcdefghijk
lkjihgfedcbabcdefghijkl
mlkjihgfedcbabcdefghijklm
nmlkjihgfedcbabcdefghijklmn
onmlkjihgfedcbabcdefghijklmno
ponmlkjihgfedcbabcdefghijklmnop
qponmlkjihgfedcbabcdefghijklmnopq
rqponmlkjihgfedcbabcdefghijklmnopqr
srqponmlkjihgfedcbabcdefghijklmnopqrs
tsrqponmlkjihgfedcbabcdefghijklmnopqrst
utsrqponmlkjihgfedcbabcdefghijklmnopqrstu
vutsrqponmlkjihgfedcbabcdefghijklmnopqrstuv
wvutsrqponmlkjihgfedcbabcdefghijklmnopqrstuvw
xwvutsrqponmlkjihgfedcbabcdefghijklmnopqrstuvwx
yxwvutsrqponmlkjihgfedcbabcdefghijklmnopqrstuvwxy
zyxwvutsrqponmlkjihgfedcbabcdefghijklmnopqrstuvwxyz

Press any key to continue

*/