Article View: alt.comp.lang.learn.c-c++
Article #158Re: C++Text Problem - Please Help
From: Willem D
Date: Wed, 07 Apr 1999 00:00
Date: Wed, 07 Apr 1999 00:00
68 lines
2452 bytes
2452 bytes
You do not write the chars after the bracket.
Check below
On Wed, 7 Apr 1999 01:32:04 +0100, "Victor" <bushmills@tesco.net>
wrote:
>I am trying to devise a program which will read a line of text from the
>prompt which includes one set of brackets round some words, eg the cat (and
>dog) played in the garden. The end result should be that the program should
>output the cat played in the garden therefore omitting the words in
>brackets.
>
>I am at the stage where the program compiles and runs but only displays the
>text before the first bracket. I have tried to get the program to display
>the text after the closing bracket but have been so far unsuccessful.
>
>Has anybody got any suggestions.
>
>I am new to C++ and therefore have only learned some of the simpler
>expressions such as those in the program below.
>
>Many thanks for your time.
>
>
>
>#include <condefs.h>
>#include "Project1io.h"
>
>#pragma hdrstop
>
>
>//--------------------------------------------------------------------------
>-
>USELIB("Project1io.lib");
>//--------------------------------------------------------------------------
>-
>#pragma argsused
>int main(int argc, char **argv)
>{
>AnsiString Sentence;
>int Index;
> Sentence = ReadStringPr("Enter your line of text containing one pair of
>brackets: ");
>
> while (Sentence == "")
> Sentence = ReadStringPr("Enter your line of text containing one pair
>of brackets: ");
>Index = 1;
> while (Sentence[Index] != '(')
>
> {
> WriteChar(Sentence[Index]);
> Index = Index + 1;
>
> }
> while (Sentence[Index] != ')')
> Index = Index + 1;
while (Index < length(Sentence))
{
WriteChar(Sentence[Index]);
Index = Index + 1;
}
> getchar();
> return 0;
>}
>
>
>
Technical Details
Message-ID:
<370b46ec.539936647@news>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<7ee92g$84c$1@barcode.tesco.net>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 109fba,1a5e82b429317717 X-Google-Attributes: gid109fba,public X-Google-Thread: 10d4ba,1a5e82b429317717 X-Google-Attributes: gid10d4ba,public X-Google-Thread: 114592,1a5e82b429317717 X-Google-Attributes: gid114592,public From: wduminy@bigfoot.com (Willem D) Subject: Re: C++Text Problem - Please Help Date: 1999/04/07 Message-ID: <370b46ec.539936647@news> X-Deja-AN: 463607120 References: <7ee92g$84c$1@barcode.tesco.net> X-Trace: 7 Apr 1999 13:54:18 +0200, s160-2.mck.co.za Newsgroups: alt.comp.lang.learn.c-c++,att.lang.c++,comp.lang.c++