Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- using namespace std;
- int main(){
- string line = "1,2,3,4,5";
- while (line.find(",", 0) != string::npos){
- int comma_pos = line.find(",", 0);
- double value = atof(line.substr(0, comma_pos).c_str());
- cout << value << endl;
- line = line.substr(comma_pos + 1, line.size() - comma_pos - 1);
- }
- cout << atof(line.c_str()) << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement