#include "stdafx.h"
#include <iostream>
#include <string>
#include <fstream>
#include <stdlib.h>
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
ifstream myfile("f.txt");
string str;
string word;
double num;
double total = 0;
if(!myfile)
cout << " Fail" << endl;
while(!myfile.eof())
{
// getline( myfile,str );
myfile >> word;
num = atof( word.c_str() );
total += num;
cout << num << endl;
}
cout << total << endl;
myfile.close();
return 0;
}