日期:2014-05-16 浏览次数:20745 次
#include <iostream>
#include <string>
#include <fstream>
#include<algorithm>
using namespace std;
int main(int argc, char* argv[])
{
if (argc != 2)
{
cout << "usage: " << argv[0] << "filename" << endl;
return 1;
}
ifstream ifs(argv[1]);
if (!ifs)
{
cout << "Error: to open the file: " << argv[1] << endl;
return 1;
}
string str;
while (getline(ifs, str))
{
transform(str.begin(),str.end(),str.begin(),::toupper);
cout<< str <<endl;
}
ifs.close();
return 0;
}