c++ - Creating variables from different line types imported from text file -
i'm trying import data text file , assign variables can analyse functions. data in following format: run 141544 event 5 njets 0 m1: pt,eta,phi,m= 231.277 0.496237 -2.22082 0.1 dptinv: 0.000370146 m2: pt,eta,phi,m= 222.408 -0.198471 0.942319 0.1 dptinv: 0.00038302 run 141544 event 7 njets 1 m1: pt,eta,phi,m= 281.327 -0.489914 1.12498 0.1 dptinv: 0.000406393 m2: pt,eta,phi,m= 238.38 0.128715 -2.07527 0.1 dptinv: 0.000399279 ... there around 15000 entries, each 4 lines. on each line, values delimited spaces, , between each entry, there blank line. because each line of entry in different format, wrote loop separate cases. problem i'm having appears wrong code assigns variables. when use loop output lines of type, runs perfectly. once try break each line variables , assign , print variables, program prints same line multiple times , crashes. here's code: #include <iostream> #include <fstream> #include <sstream> #include <cmath> #include ...