+ 1

is there a split() for c++? 

Sepearate , from number

14th Oct 2020, 9:11 AM
Faezeh Alinejad
Faezeh Alinejad - avatar
8 Answers
+ 3
strtok() function works for strings only and returns pointer to first character of the new string or NULL otherwise.(you can see the details in strcat() documentation) But if you want to take floating point numbers seperated by a comma as input then you can easily do something like this👇 https://code.sololearn.com/c7p6eKplg9gS/?ref=app
14th Oct 2020, 12:47 PM
Arsenic
Arsenic - avatar
+ 5
You can use strtok() function to split the string like this👇 https://code.sololearn.com/caiXHJx2c1qz/?ref=app
14th Oct 2020, 9:54 AM
Arsenic
Arsenic - avatar
+ 2
No, you have to split strings on your own.
14th Oct 2020, 9:36 AM
加油 我先下了
加油 我先下了 - avatar
+ 2
Arsenic ahha. May you explain the logic of the program?
14th Oct 2020, 10:01 AM
Faezeh Alinejad
Faezeh Alinejad - avatar
+ 2
I want the input to be received two floats as 1.5 , 2
14th Oct 2020, 10:07 AM
Faezeh Alinejad
Faezeh Alinejad - avatar
+ 2
It ok .Thankyou so much👍🏻👍🏻
14th Oct 2020, 12:50 PM
Faezeh Alinejad
Faezeh Alinejad - avatar
+ 2
the above example is c style splitting. You can try this c++ approach of splitting if you want. https://code.sololearn.com/ceVFQl77SUD0/?ref=app
14th Oct 2020, 1:09 PM
Flash
+ 1
Flash it is ok thankyou
14th Oct 2020, 1:56 PM
Faezeh Alinejad
Faezeh Alinejad - avatar