10.1
#include<iostream>
#include<fstream>
#include<string>
using namespace std;
int main()
{
cout<<"Please enter input file name: ";
string name;
cin>>name;
ifstream ist(name.c_str());
if(!ist) perror("can't open input file");
int temp,sum=0;
while(ist>>temp)
{
if(temp!=' ') sum=sum+temp;
}
cout<<"sum= "<<sum<<endl;
system("pause");
}
10.2
#include<iostream>
#include<fstream>
using namespace std;
int main()
{
cout<<"创建文件raw_temps.txt ..."<<endl;
ofstream ost("E:\\raw_temps.txt");
if(!ost) cout<<"无法创建文件..."<<endl;
int hour;
double temperature;
cout<<"输入时间 温度格式数据(输入0~24范围外的时间退出输入)"<<endl;
while(1)
{
cin>>hour;
if(hour<