Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c++ > #6978

Re: Conversion of a number from string to vector<int>

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!feeder.news-service.com!newsfeed101.telia.com!starscream.dk.telia.net!news.tele.dk!feed118.news.tele.dk!not-for-mail
Newsgroups comp.lang.c++
Subject Re: Conversion of a number from string to vector<int>
References <itip2s$nkn$1@speranza.aioe.org> <EI6Lp.4092$NX1.725@newsfe18.ams2> <4dfd93f0$0$2848$7b1e8fa0@news.nbl.fi> <EahLp.7555$Ll1.6425@newsfe24.ams2> <4dfee42a$0$2831$7b1e8fa0@news.nbl.fi> <968gfuFsmeU5@mid.individual.net> <vpELp.5906$b91.4974@newsfe19.ams2>
From Lasse Reichstein Nielsen <lrn.unread@gmail.com>
Date Mon, 20 Jun 2011 22:47:04 +0200
Message-ID <7h8gz0vr.fsf@gmail.com> (permalink)
User-Agent Gnus/5.1006 (Gnus v5.10.6) XEmacs/21.4 (Rational FORTRAN, windows-nt)
Cancel-Lock sha1:RJFfbim8VYnk/5Wxbs3BEB2KNrI=
MIME-Version 1.0
Content-Type text/plain; charset=us-ascii
Lines 30
Organization TDC Totalloesninger
NNTP-Posting-Host 87.57.52.80
X-Trace 1308602842 dtext01.news.tele.dk 36579 87.57.52.80:45372
X-Complaints-To abuse@post.tele.dk
Xref x330-a1.tempe.blueboxinc.net comp.lang.c++:6978

Show key headers only | View raw


"Paul" <pchristor@yahoo.co.uk> writes:

> I see some people are using the subtraction of char '0' technique, but
> this seems a bit weird to me as chars are not supposed to behave like
> that..

Like what?
The char type is an integral type. You can subtract them just fine.

> IIRC there is something in the standard about the chars '0' - '9'
> having special pirvaleges with arithmetic operators.

I doubt that.

> Does the following char arithmetic work?
>
> '4'  *  '2'

No, unless you want the result to be 2600.

> Will give us an integer value of 8? Sorry too lazy to check, I m
> having my morning tea :)

Not 8, no.

/L
-- 
Lasse Reichstein Holst Nielsen
 DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
  'Faith without judgement merely degrades the spirit divine.'

Back to comp.lang.c++ | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Conversion of a number from string to vector<int> Anonymous <anonymous@no.net> - 2011-06-18 19:59 +0200
  Re: Conversion of a number from string to vector<int> "Paul" <pchristor@yahoo.co.uk> - 2011-06-18 20:08 +0100
    Re: Conversion of a number from string to vector<int> Anonymous <anonymous@no.net> - 2011-06-18 23:55 +0200
      Re: Conversion of a number from string to vector<int> Victor Bazarov <v.bazarov@comcast.invalid> - 2011-06-18 18:26 -0400
    Re: Conversion of a number from string to vector<int> Juha Nieminen <nospam@thanks.invalid> - 2011-06-19 06:15 +0000
      Re: Conversion of a number from string to vector<int> "Paul" <pchristor@yahoo.co.uk> - 2011-06-19 08:02 +0100
        Re: Conversion of a number from string to vector<int> Anonymous <anonymous@no.net> - 2011-06-19 12:19 +0200
          Re: Conversion of a number from string to vector<int> "Paul" <pchristor@yahoo.co.uk> - 2011-06-19 16:07 +0100
            Re: Conversion of a number from string to vector<int> Anonymous <anonymous@no.net> - 2011-06-19 17:50 +0200
            Re: Conversion of a number from string to vector<int> Juha Nieminen <nospam@thanks.invalid> - 2011-06-20 06:12 +0000
              Re: Conversion of a number from string to vector<int> "Paul" <pchristor@yahoo.co.uk> - 2011-06-20 09:57 +0100
        Re: Conversion of a number from string to vector<int> Juha Nieminen <nospam@thanks.invalid> - 2011-06-20 06:09 +0000
          Re: Conversion of a number from string to vector<int> "Paul" <pchristor@yahoo.co.uk> - 2011-06-20 09:48 +0100
          Re: Conversion of a number from string to vector<int> Ian Collins <ian-news@hotmail.com> - 2011-06-20 20:59 +1200
            Re: Conversion of a number from string to vector<int> "Paul" <pchristor@yahoo.co.uk> - 2011-06-20 10:17 +0100
              Re: Conversion of a number from string to vector<int> Lasse Reichstein Nielsen <lrn.unread@gmail.com> - 2011-06-20 22:47 +0200
                Re: Conversion of a number from string to vector<int> "Paul" <pchristor@yahoo.co.uk> - 2011-06-20 22:05 +0100
  Re: Conversion of a number from string to vector<int> Ian Collins <ian-news@hotmail.com> - 2011-06-19 08:35 +1200
  Re: Conversion of a number from string to vector<int> Juha Nieminen <nospam@thanks.invalid> - 2011-06-19 06:23 +0000
    Re: Conversion of a number from string to vector<int> Kai-Uwe Bux <jkherciueh@gmx.net> - 2011-06-19 12:14 +0200
    Re: Conversion of a number from string to vector<int> Anonymous <anonymous@no.net> - 2011-06-19 13:13 +0200
      Re: Conversion of a number from string to vector<int> Pete Becker <pete@versatilecoding.com> - 2011-06-19 11:42 -0400
        Re: Conversion of a number from string to vector<int> "Paul" <pchristor@yahoo.co.uk> - 2011-06-19 20:54 +0100
        Re: Conversion of a number from string to vector<int> Anonymous <anonymous@no.net> - 2011-06-19 23:06 +0200
          Re: Conversion of a number from string to vector<int> Pete Becker <pete@versatilecoding.com> - 2011-06-19 17:18 -0400
          Re: Conversion of a number from string to vector<int> "Paul" <pchristor@yahoo.co.uk> - 2011-06-20 00:11 +0100
            Re: Conversion of a number from string to vector<int> "Paul" <pchristor@yahoo.co.uk> - 2011-06-20 00:32 +0100
    Re: Conversion of a number from string to vector<int> Juha Nieminen <nospam@thanks.invalid> - 2011-06-20 06:18 +0000
  Re: Conversion of a number from string to vector<int> Sam <sam@email-scan.com> - 2011-06-21 06:05 -0500

csiph-web