Advertisement
Guest User

Untitled

a guest
Nov 24th, 2014
164
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. infile.open (fileName.c_str());
  2. string line = "";
  3. getline(myFile,line,'#'); // Puts the first line of myFile and puts it into a string
  4. string nextDouble="";
  5. int curArraySpot=0;
  6. while(!line.empty()
  7. {
  8. if(line[0]==" ")
  9. {
  10. double newDub=nextDouble;
  11. yourArray[curArraySpot]=newDub; // change nextDouble from string to double and place it in array
  12. curArraySpot++;
  13. nextDouble="";
  14. }
  15. else
  16. {
  17. nextDouble=nextDouble+line[0]; // add the next char from line to your new string
  18. line=line.substring(1); // Removes the first char from line, shortening it by 1
  19. }
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement