Re: Alternative COBOL "telco" source program
From: L Russ (lruss_at_superlink.net)
Date: 05/27/04
- Next message: John Simpson: "Re: win98 to XP"
- Previous message: Frederico Fonseca: "Re: Sign Problem---Following example"
- In reply to: robin: "Re: Alternative COBOL "telco" source program"
- Next in thread: dot: "Re: Alternative COBOL "telco" source program"
- Reply: dot: "Re: Alternative COBOL "telco" source program"
- Reply: David Frank: "Re: Alternative COBOL "telco" source program"
- Reply: Michael Mattias: "Re: Alternative COBOL "telco" source program"
- Reply: LX-i: "Re: Alternative COBOL "telco" source program"
- Reply: Robert Wagner: "Re: Alternative COBOL "telco" source program"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 27 May 2004 12:51:39 -0700
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.
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;
}
And I expect, as you've said, that PL/I offers something similar.
Anyone care to try this in SNOBOL?
LR
- Next message: John Simpson: "Re: win98 to XP"
- Previous message: Frederico Fonseca: "Re: Sign Problem---Following example"
- In reply to: robin: "Re: Alternative COBOL "telco" source program"
- Next in thread: dot: "Re: Alternative COBOL "telco" source program"
- Reply: dot: "Re: Alternative COBOL "telco" source program"
- Reply: David Frank: "Re: Alternative COBOL "telco" source program"
- Reply: Michael Mattias: "Re: Alternative COBOL "telco" source program"
- Reply: LX-i: "Re: Alternative COBOL "telco" source program"
- Reply: Robert Wagner: "Re: Alternative COBOL "telco" source program"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|