Re: Alternative COBOL "telco" source program

From: David Frank (dave_frank_at_hotmail.com)
Date: 05/28/04


Date: Fri, 28 May 2004 08:42:43 GMT


"L Russ" <lruss@superlink.net> wrote in message
news:cfaeadf3.0405271151.20c59a4@posting.google.com...
> robin <robin_v@bigpond.mapson.com> wrote in message
> news:<Iadtc.12799$L.1063@news-server.bigpond.net.au>...
>> From: "Michael Mattias" <michael.mattias@gte.net>, SBC
>> http://yahoo.sbc.com
>> Date: Wed, 26 May 2004 12:09:48 GMT
>> .
>> | Some of these "can'ts" are so incredibly banal...
>> .
>> They all are.
>
> They are all worse, much worse, than banal.
>
>> .
>> | e.g., # 18 "CANT find last
>> | word index in trailing blank text using a loop <= 3 statements."
>> .
>> Not only can this be done in PL/I,
>> it can be done by a beginner.
>> Furthermore, it can be done in PL/I in one statement.
>
> But if you do it in one statement, then it's not in a loop, and CAN'T
> 18 clearly states that you should use a loop, with at most 3
> statements, implying that using a loop (with three statements or less)
> is really the important thing when you do this task. Even if the
> language you use doesn't require that you do it that way.
>
> Here's my version using C++, no loop. Another FORTRAN CAN'T. Big
> deal.

Wanna bet?

> And yes, string and iostream are part of the C++ standard, so it's not
> like anyone can't duplicate this code if you've got a conformant
> compiler.
>
> #include <string>
> #include <iostream>
> int main() {
> const std::string s = "The quick brown fox jumps over the lazy dog's
> back. ";
> std::cout << s.substr(0, s.find_last_not_of(" ")+1) << std::endl;
> return 0;
> }
>

IMO, horrific syntax, but thats nothing new for C++ statements is it?
and its sure not apparent to me that above outputs 2 lines, does it?



Relevant Pages

  • Re: Basic file operation questions
    ... > I am a beginner with python and here is my first question: ... > How can I read the contents of a file using a loop or something? ...
    (comp.lang.python)
  • Re: generate Matrix with ones
    ... > I've a beginner question... ... > course, it could be easily realized by a for loop, but for speed ... The DEC2BIN function will help you. ...
    (comp.soft-sys.matlab)
  • Re: FORRTRAN CANT (was: Alternative COBOL "telco" source program)
    ... lruss@superlink.net writes: ... A beginner could solve most of them, ... > But if you do it in one statement, then it's not in a loop, and CAN'T ... is that Frank can't do it any other way. ...
    (comp.lang.cobol)
  • Re: Strcpy versus Strncpy in arrays
    ... >>> Inside the body of the loop. ... I'm sure Mark knows how it actually works. ... > Beginner known that i++ returns the value from before the increment. ...
    (comp.lang.c)
  • generate Matrix with ones
    ... I've a beginner question... ... I'd like to generate a matrix in matlab with a different ... course, it could be easily realized by a for loop, but for speed ... Prev by Date: ...
    (comp.soft-sys.matlab)