🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: alt.comp.lang.learn.c-c++
Article #156

C++Text Problem - Please Help

#156
From: Victor
Date: Wed, 07 Apr 1999 00:00
60 lines
2136 bytes
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;



    getchar();
    return 0;
}
Technical Details
Message-ID: <7ee92g$84c$1@barcode.tesco.net>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 114592,1a5e82b429317717
X-Google-Attributes: gid114592,public
X-Google-Thread: 109fba,1a5e82b429317717
X-Google-Attributes: gid109fba,public
X-Google-Thread: 10d4ba,1a5e82b429317717
X-Google-Attributes: gid10d4ba,public
From: "Victor" <bushmills@tesco.net>
Subject: C++Text Problem - Please Help
Date: 1999/04/07
Message-ID: <7ee92g$84c$1@barcode.tesco.net>
X-Deja-AN: 463451122
Organization: Little ( if any )
Newsgroups: alt.comp.lang.learn.c-c++,att.lang.c++,comp.lang.c++
X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3