For Programmers: Free Programming Magazines  


Home > Archive > VC STL > April 2005 > HELP! string problem









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author HELP! string problem
SkyHunter

2005-04-21, 4:02 am

I have two string "0010" and "001A".I want to create a string list
("0010","0011","0012",......,"0019","001A"). How can I do it?Thanks~~
Brian Muth

2005-04-21, 4:02 pm

This sounds suspiciously like a question from a homework assignment.

Brian



James Curran

2005-04-22, 4:04 pm

What assumption can be made about the inital strings. Will they always
be hex numbers?

--
--
Truth,
James Curran
[erstwhile VC++ MVP]

Home: www.noveltheory.com Work: www.njtheater.com
Blog: www.honestillusion.com Day Job: www.partsearch.com

"SkyHunter" <tompkins2000@hotmail.com> wrote in message
news:u1fssAiRFHA.3788@tk2msftngp13.phx.gbl...
> I have two string "0010" and "001A".I want to create a string list
> ("0010","0011","0012",......,"0019","001A"). How can I do it?Thanks~~



xcoder

2005-04-28, 4:06 am



"James Curran" wrote:

> What assumption can be made about the inital strings. Will they always
> be hex numbers?
>
> --
> --
> Truth,
> James Curran
> [erstwhile VC++ MVP]
>
> Home: www.noveltheory.com Work: www.njtheater.com
> Blog: www.honestillusion.com Day Job: www.partsearch.com
>
> "SkyHunter" <tompkins2000@hotmail.com> wrote in message
> news:u1fssAiRFHA.3788@tk2msftngp13.phx.gbl...
>
>
>

Hi,
Maybe you could use vector instead and create a new vector type of string

typedef vector<string> strvector; <-- create a new vector of string
strvector mylist;

//adding values to vector
mylist.push_back("0010");
mylist.push_back("0011");

//retrieving value from vector
mylist[0].c_str();


Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com