Advertisement
Guest User

Untitled

a guest
Apr 22nd, 2016
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3. using std::fstream;
  4. #include <string>
  5. using std::string;
  6. #include <sstream>
  7. using std::stringstream;
  8. #include <vector>
  9. using std::vector;
  10. using namespace std;
  11.  
  12.  
  13. double data1 = 0, data2 = 0 , data3 = 0;
  14.  
  15. int main(){
  16.  
  17. fstream fakedatafile;
  18. fakedatafile.open("fakename.txt");
  19.  
  20. string fakeline;
  21.  
  22. if(fakedatafile.good()){
  23. fakedatafile>>fakeline;
  24. for(int n = 0; n < 100; n++){
  25. fakedatafile>>fakeline;
  26. int firstspace = fakeline.find(" ");
  27. int secondspace = fakeline.find(" ", firstspace+1);
  28. stringstream fakedatafile;
  29. fakedatafile<<fakeline.substr(secondspace + 1);
  30. fakedatafile>>data1;
  31. fakedatafile>>data2;
  32. fakedatafile>>data3;
  33. cout<<data1<<endl;
  34. cout<<data2<<endl;
  35. cout<<data3<<endl;
  36. cout<<"N IS HERE "<<n<<endl;
  37.  
  38. }
  39. }
  40.  
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement