c++ - how to split cin input -


i facing problem split input in c++, similar python split function.
input given 1001-43 1003-45 1008-67 in different lines. want know how take these inputs split '-' , store them in different variables.

in python it's:

a, x = input().split('-') 

have @ boost. string algorithms library includes of can find in python including split function splits string stl container of choice. example (lifted docs) splitting on dash or asterisk:

std::string str1("hello abc-*-abc-*-abc goodbye");  std::vector< std::string > splitvec; // #2: search tokens split( splitvec, str1, is_any_of("-*"), token_compress_on );  // splitvec == { "hello abc","abc","abc goodbye" } 

Comments

Popular posts from this blog

c# - SVN Error : "svnadmin: E205000: Too many arguments" -

c++ - Using OpenSSL in a multi-threaded application -

All overlapping substrings matching a java regex -