Advertisement
Guest User

Untitled

a guest
Mar 26th, 2019
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. #include <vector>
  4.  
  5. int main()
  6. {
  7. char buffer[200] = "M(120.95, 250.5) (1.2, 2.3)";
  8. std::string z = "";
  9. int n = 27;
  10. std::vector<double>Tablica;
  11. for (int i = 0; i < 240; i++)
  12. {
  13. if (buffer[i] != 'M' && buffer[i] != '(' && buffer[i] != ')')
  14. {
  15. if (buffer[i] != ' ' && buffer[i] != ',' && i<=n+1)
  16. {
  17. z += buffer[i];
  18. }
  19. else if(z.length()!=0)
  20. {
  21. Tablica.push_back(atof(z.c_str()));
  22. z = "";
  23. }
  24.  
  25. }
  26. }
  27.  
  28. for (int i = 0; i < Tablica.capacity(); i++)
  29. {
  30. std::cout << Tablica[i] <<std::endl;
  31. }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement