Click here to Skip to main content
15,920,801 members

Welcome to the Lounge

   

For discussing anything related to a software developer's life but is not for programming questions. Got a programming question?

The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.

 
GeneralRe: Maybe you guys can laugh at this... I still cannot. Pin
Gary Wheeler29-Jan-14 0:14
Gary Wheeler29-Jan-14 0:14 
JokeRe: Maybe you guys can laugh at this... I still cannot. Pin
Richard C Bishop28-Jan-14 11:07
professionalRichard C Bishop28-Jan-14 11:07 
GeneralRe: Maybe you guys can laugh at this... I still cannot. Pin
Joe Woodbury28-Jan-14 12:00
professionalJoe Woodbury28-Jan-14 12:00 
GeneralRe: Maybe you guys can laugh at this... I still cannot. Pin
Dan Neely29-Jan-14 2:48
Dan Neely29-Jan-14 2:48 
GeneralRe: Maybe you guys can laugh at this... I still cannot. Pin
BrainiacV29-Jan-14 7:38
BrainiacV29-Jan-14 7:38 
GeneralRe: Maybe you guys can laugh at this... I still cannot. Pin
KP Lee29-Jan-14 10:24
KP Lee29-Jan-14 10:24 
GeneralRe: Maybe you guys can laugh at this... I still cannot. Pin
BrainiacV29-Jan-14 10:58
BrainiacV29-Jan-14 10:58 
GeneralRe: Maybe you guys can laugh at this... I still cannot. Pin
KP Lee29-Jan-14 13:32
KP Lee29-Jan-14 13:32 
LMAF
So, how did he fit a 132 character string on the 80 character screen? What if the string had leading or trailing blanks?
Reminds me of a challenge to print 9 lines. Wrote a routine to write up to 197 lines:
C#
/// <summary>
/// Goes from 1 to 99, lists on Console the number incremented forward and backwards
/// Right adjusting the values. All values except the last number are repeated in reverse order
/// IE if 5 is passed "123454321" is fifth line, 9 lines total listed
/// </summary>
/// <param name="num">The largest middle number</param>
static void stringlist(int num)
{
    if (num < 0) num = -num;
    if (num < 2)
    {
        Console.WriteLine("1");
        return;
    }
    if (num > 99)
    {
        Console.WriteLine("Passed number ({0}) exceeds 99, setting to 99", num);
        num = 99;
    }
    List<string> forward = new List<string>();
    StringBuilder left = new StringBuilder(), right = new StringBuilder(), pad = new StringBuilder();
    int len = 0;
    for (int i = 1; i <= num; i++)
    {
        pad.Append("    ");
        left.Append(i);
        string x = left.ToString() + right.ToString();
        forward.Add(x);
        len = x.Length;
        right.Insert(0, i);
    }
    foreach (string x in forward)
        if (x.Length == len) Console.WriteLine(x);
        else Console.WriteLine("{0}{1}", pad.ToString(0, len - x.Length), x);
    for (int i = forward.Count - 2; i > -1; i--)//-2 points to the next to last number
        Console.WriteLine("{0}{1}", pad.ToString(0, len - forward[i].Length), forward[i]);
}
So, how would you grade my coding?
OK, OK, so I put one ineffiecient line in that I decided to keep in. Anything else you would complain about it?
GeneralRe: Maybe you guys can laugh at this... I still cannot. Pin
BrainiacV30-Jan-14 4:14
BrainiacV30-Jan-14 4:14 
GeneralRe: Maybe you guys can laugh at this... I still cannot. Pin
KP Lee30-Jan-14 9:46
KP Lee30-Jan-14 9:46 
GeneralRe: Maybe you guys can laugh at this... I still cannot. Pin
SoMad28-Jan-14 17:49
professionalSoMad28-Jan-14 17:49 
GeneralRe: Maybe you guys can laugh at this... I still cannot. Pin
sir_download_alot28-Jan-14 20:45
professionalsir_download_alot28-Jan-14 20:45 
GeneralRe: Maybe you guys can laugh at this... I still cannot. Pin
Herbie Mountjoy28-Jan-14 21:15
professionalHerbie Mountjoy28-Jan-14 21:15 
GeneralRe: Maybe you guys can laugh at this... I still cannot. Pin
glennPattonWork328-Jan-14 21:54
professionalglennPattonWork328-Jan-14 21:54 
GeneralRe: Maybe you guys can laugh at this... I still cannot. Pin
grralph129-Jan-14 2:14
grralph129-Jan-14 2:14 
GeneralRe: Maybe you guys can laugh at this... I still cannot. Pin
Dan Neely29-Jan-14 2:38
Dan Neely29-Jan-14 2:38 
GeneralRe: Maybe you guys can laugh at this... I still cannot. Pin
Alexander DiMauro29-Jan-14 3:32
Alexander DiMauro29-Jan-14 3:32 
GeneralRe: Maybe you guys can laugh at this... I still cannot. Pin
Sharon Freas29-Jan-14 3:49
Sharon Freas29-Jan-14 3:49 
Generalan honest comment Pin
etkid8429-Jan-14 5:04
etkid8429-Jan-14 5:04 
GeneralRe: an honest comment Pin
mgoad9929-Jan-14 5:12
mgoad9929-Jan-14 5:12 
GeneralRe: an honest comment Pin
etkid8429-Jan-14 5:17
etkid8429-Jan-14 5:17 
GeneralRe: Maybe you guys can laugh at this... I still cannot. Pin
RafagaX29-Jan-14 5:43
professionalRafagaX29-Jan-14 5:43 
GeneralRe: Maybe you guys can laugh at this... I still cannot. Pin
bkebamc29-Jan-14 6:00
bkebamc29-Jan-14 6:00 
GeneralRe: Maybe you guys can laugh at this... I still cannot. Pin
rjmoses29-Jan-14 6:02
professionalrjmoses29-Jan-14 6:02 
GeneralRe: Maybe you guys can laugh at this... I still cannot. Pin
jhfw5829-Jan-14 20:55
professionaljhfw5829-Jan-14 20:55 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.