VS2008从TXT文本读取数据如何实现?
我有一文本,里面第一行为字符,接下来每行有两个数据,中间用Tab隔开,数据部分片段如下所示。每一行第一个数据为时间,单位是天。第二个是我想要的数据。我想用VS2008做一...
我有一文本,里面第一行为字符,接下来每行有两个数据,中间用Tab隔开,
数据部分片段如下所示。每一行第一个数据为时间,单位是天。第二个是我想要的数据。我想用VS2008做一程序,当然是有界面的。现在能实现利用openfiledialog组件打开一个对话框,但是接下来读取这个文件就不会了。
我想要的结果就是先判断第一个数据是否是在同一天内,然后再把同在一天的数据行中的第二个数据相加求平均值。请问要用哪个类来打开此文件,并读取每一行的两个数据呢?当然是C++了,还要是VS2008里的类。
1488 i=16,j=7, Depth Avg
30.0416660308838 32.1845321655273
30.0833339691162 32.0419082641602
30.125 31.8959503173828
30.1666660308838 31.7493343353271
30.2083339691162 31.5983619689941
30.25 31.4529857635498
30.2916660308838 31.359130859375
30.3333339691162 31.3201465606689
30.375 31.34006690979
30.4166660308838 31.4142227172852
30.4583339691162 31.5244579315186
30.5 31.6584606170654
30.5416660308838 31.8044567108154
30.5833339691162 31.9504318237305
30.625 32.088981628418
30.6666660308838 32.2132377624512
30.7083339691162 32.3030776977539
30.75 32.3405265808105
30.7916660308838 32.3161239624023
30.8333339691162 32.2375869750977
30.875 32.1431045532227
30.9166660308838 32.0307121276855
30.9583339691162 31.8981475830078
31 31.7449531555176
31.0416660308838 31.5675449371338
31.0833339691162 31.3629093170166
31.125 31.1343612670898
31.1666660308838 30.885461807251
31.2083339691162 30.6161308288574
31.25 30.3290176391602
31.2916660308838 30.0710697174072
31.3333339691162 29.8783893585205
31.375 29.7727394104004
31.4166660308838 29.7751369476318
31.4583339691162 29.8856239318848
31.5 30.0748310089111
31.5416660308838 30.3056659698486
31.5833339691162 30.542308807373
31.625 30.7719593048096
31.6666660308838 30.9725952148438
31.7083339691162 31.1169185638428
31.75 31.187141418457
31.7916660308838 31.1790065765381
31.8333339691162 31.1020736694336
31.875 31.0021171569824
31.9166660308838 30.8854923248291
31.9583339691162 30.7562789916992
32 30.6178131103516
32.0416679382324 30.471866607666
32.0833320617676 30.3211135864258
32.125 30.1703300476074
32.1666679382324 30.0237903594971
32.2083320617676 29.8824100494385
32.25 29.7551593780518
32.2916679382324 29.6966171264648
32.3333320617676 29.7161331176758
32.375 29.7874412536621
32.4166679382324 29.9062080383301
32.4583320617676 30.0879707336426
32.5 30.2883186340332
32.5416679382324 30.4971294403076
32.5833320617676 30.7264556884766
32.625 30.9809131622314
32.6666679382324 31.2230529785156
32.7083320617676 31.4162483215332
32.75 31.5480461120605
32.7916679382324 31.6089057922363
32.8333320617676 31.597110748291
32.875 31.5587196350098
32.9166679382324 31.5036563873291
32.9583320617676 31.4371681213379
兄弟,多谢回答。但为何要学数据库呀? 展开
数据部分片段如下所示。每一行第一个数据为时间,单位是天。第二个是我想要的数据。我想用VS2008做一程序,当然是有界面的。现在能实现利用openfiledialog组件打开一个对话框,但是接下来读取这个文件就不会了。
我想要的结果就是先判断第一个数据是否是在同一天内,然后再把同在一天的数据行中的第二个数据相加求平均值。请问要用哪个类来打开此文件,并读取每一行的两个数据呢?当然是C++了,还要是VS2008里的类。
1488 i=16,j=7, Depth Avg
30.0416660308838 32.1845321655273
30.0833339691162 32.0419082641602
30.125 31.8959503173828
30.1666660308838 31.7493343353271
30.2083339691162 31.5983619689941
30.25 31.4529857635498
30.2916660308838 31.359130859375
30.3333339691162 31.3201465606689
30.375 31.34006690979
30.4166660308838 31.4142227172852
30.4583339691162 31.5244579315186
30.5 31.6584606170654
30.5416660308838 31.8044567108154
30.5833339691162 31.9504318237305
30.625 32.088981628418
30.6666660308838 32.2132377624512
30.7083339691162 32.3030776977539
30.75 32.3405265808105
30.7916660308838 32.3161239624023
30.8333339691162 32.2375869750977
30.875 32.1431045532227
30.9166660308838 32.0307121276855
30.9583339691162 31.8981475830078
31 31.7449531555176
31.0416660308838 31.5675449371338
31.0833339691162 31.3629093170166
31.125 31.1343612670898
31.1666660308838 30.885461807251
31.2083339691162 30.6161308288574
31.25 30.3290176391602
31.2916660308838 30.0710697174072
31.3333339691162 29.8783893585205
31.375 29.7727394104004
31.4166660308838 29.7751369476318
31.4583339691162 29.8856239318848
31.5 30.0748310089111
31.5416660308838 30.3056659698486
31.5833339691162 30.542308807373
31.625 30.7719593048096
31.6666660308838 30.9725952148438
31.7083339691162 31.1169185638428
31.75 31.187141418457
31.7916660308838 31.1790065765381
31.8333339691162 31.1020736694336
31.875 31.0021171569824
31.9166660308838 30.8854923248291
31.9583339691162 30.7562789916992
32 30.6178131103516
32.0416679382324 30.471866607666
32.0833320617676 30.3211135864258
32.125 30.1703300476074
32.1666679382324 30.0237903594971
32.2083320617676 29.8824100494385
32.25 29.7551593780518
32.2916679382324 29.6966171264648
32.3333320617676 29.7161331176758
32.375 29.7874412536621
32.4166679382324 29.9062080383301
32.4583320617676 30.0879707336426
32.5 30.2883186340332
32.5416679382324 30.4971294403076
32.5833320617676 30.7264556884766
32.625 30.9809131622314
32.6666679382324 31.2230529785156
32.7083320617676 31.4162483215332
32.75 31.5480461120605
32.7916679382324 31.6089057922363
32.8333320617676 31.597110748291
32.875 31.5587196350098
32.9166679382324 31.5036563873291
32.9583320617676 31.4371681213379
兄弟,多谢回答。但为何要学数据库呀? 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询