delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/01/04/11:26:19

From: "Brian MacBride" <macbride AT ix DOT netcom DOT com>
Newsgroups: comp.os.msdos.djgpp
References: <84t0lf$2e5$1 AT nclient3-gui DOT server DOT dtn DOT ntl DOT com>
Subject: Re: Problems compling c++
Lines: 74
Organization: Signal Computing Service Ltd.
MIME-Version: 1.0
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.00.2919.6600
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6600
Message-ID: <8Yoc4.340$Qa5.3490@hnlnewsr2.hawaii.rr.com>
Date: Tue, 04 Jan 2000 16:10:44 GMT
NNTP-Posting-Host: 204.210.106.78
X-Complaints-To: abuse AT rr DOT com
X-Trace: hnlnewsr2.hawaii.rr.com 947002244 204.210.106.78 (Tue, 04 Jan 2000 06:10:44 HST)
NNTP-Posting-Date: Tue, 04 Jan 2000 06:10:44 HST
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

"Andy" <a DOT pelton AT dtn DOT ntl DOT com> wrote in message
news:84t0lf$2e5$1 AT nclient3-gui DOT server DOT dtn DOT ntl DOT com...
> ok, I am learning c++ using Soustroups book "The c++ programming language
> 3rd Ed". I have just been trying to get the desttop calculator to work
(from
> chap 6, Ex 18).
>
> It will not compile, but I think the error is related to incomplete STL.
is
> this so?
>
> here is the errror messages
>
> c6ex18.cpp: In function `enum Token_value get_token()':
> c6ex18.cpp:152: no matching function for call to
>
`basic_string<char,string_char_traits<char>,__default_alloc_template<false,0
> > >::push_back (char &)'
>
> the source is added as an attachment.
>
> thanks in advance
>
> andy
>
>
>
>
>
>

Consider...

Token_value get_token()
{
  char ch=0;

    <snip>

  default:
    if(isalpha(ch)) {
      string_value = ch;
      while(cin.get(ch) && isalnum(ch))

        // was ??
        // string_value.push_back(ch);
        // now !!
        string_value += ch;

      cin.putback(ch);
      return curr_tok=NAME;
    }
    error("bad token");
    return curr_tok = PRINT;
  }
}

/
*Yields...

(2+3)*4+3*2
26

*/

Is that what you wanted??

Regards

Brian



- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019