public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: "Lev Assinovsky" <LAssinovsky@algorithm.aelita.com>
To: "learning c++" <learning_c@hotmail.com>, <gcc-help@gcc.gnu.org>
Subject: RE: error: no match for `std::string& != long int' operator
Date: Wed, 01 Sep 2004 10:38:00 -0000	[thread overview]
Message-ID: <A791774B798C024D98F7E10961E99E71896CF6@SPBMX0.edm.com> (raw)

Sorry, but you code is wrong.
string is a class name and s1 is an object.
You can't apply != NULL or ++ unless 
these operators are declared by basic_string.
As far as I know basic_string doesn't have those operators.

-----Original Message-----
From: gcc-help-owner@gcc.gnu.org [mailto:gcc-help-owner@gcc.gnu.org]On
Behalf Of learning c++
Sent: Wednesday, September 01, 2004 2:23 PM
To: gcc-help@gcc.gnu.org
Subject: error: no match for `std::string& != long int' operator


Hi,
I have a short code hope to print the character of a string one by one. but 
there are some errors.

if I declare srting s1, is s1 a pointer? are there some difference between C 
and C++?
#include <iostream>
#include <string>

using namespace std;

int main(){

string s1("0123456789abcdefghijklmnopqrstuvwxyz");
for(s1; s1!=NULL; ++s1)
cout <<*s1<<" " <<int(*s1)<<"  ";

return 0;

}
printc.cpp: In function `int main()':
printc.cpp:9: error: no match for `std::string& != long int' operator
printc.cpp:9: error: no match for `++ std::string&' operator
printc.cpp:10: error: no match for `* std::string&' operator
printc.cpp:10: error: no match for `* std::string&' operator
printc.cpp:9: warning: statement with no effect

_________________________________________________________________
The new MSN 8: advanced junk mail protection and 2 months FREE* 
http://join.msn.com/?page=features/junkmail

             reply	other threads:[~2004-09-01 10:38 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-09-01 10:38 Lev Assinovsky [this message]
  -- strict thread matches above, loose matches on Subject: below --
2004-09-01 10:22 learning c++
2004-09-01 11:07 ` Arno Wilhelm

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=A791774B798C024D98F7E10961E99E71896CF6@SPBMX0.edm.com \
    --to=lassinovsky@algorithm.aelita.com \
    --cc=gcc-help@gcc.gnu.org \
    --cc=learning_c@hotmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).