77、78、79
来源:互联网 发布:java 二级考试真题 编辑:程序博客网 时间:2024/06/05 14:22
#include <fstream>
#include <strstream>
#include <cstdlib>
using namespace std;
#include <strstream>
#include <cstdlib>
using namespace std;
int main(int argc, char* argv[])
{
strstream textfile;
{
ifstream in(argv[1]);
textfile << in.rdbuf();
}
ofstream out(argv[2]);
const int bsz = 100;
char buf[bsz];
int line = 0;
while(textfile.getline(buf, bsz)) {
out.setf(ios::right, ios::adjustfield);
out.width(1);
out << ++line << ". " << buf << endl;
}
return 0;
}
{
strstream textfile;
{
ifstream in(argv[1]);
textfile << in.rdbuf();
}
ofstream out(argv[2]);
const int bsz = 100;
char buf[bsz];
int line = 0;
while(textfile.getline(buf, bsz)) {
out.setf(ios::right, ios::adjustfield);
out.width(1);
out << ++line << ". " << buf << endl;
}
return 0;
}
#include <iostream>
#include <fstream>
#include <string>
#include <map>
using namespace std;
#include <fstream>
#include <string>
#include <map>
using namespace std;
int main()
{
locale loc(".936"); //创建本地化配置方案
wcout.imbue(loc); //为wcout设置编码方案
wifstream in(L"习题9-10输入.txt"); //创建文件宽输入流
wofstream out(L"习题9-10输出.txt"); //创建文件宽输入流
in.imbue(loc); //为in设置编码方案
out.imbue(loc); //为out设置编码方案
wstring line; //用来存储一行内容
map<wchar_t, int> counter;
while(getline(in,line))
{
for(int i=0; i<line.length(); ++i)
{
counter[line[i]] ++;
}
}
{
locale loc(".936"); //创建本地化配置方案
wcout.imbue(loc); //为wcout设置编码方案
wifstream in(L"习题9-10输入.txt"); //创建文件宽输入流
wofstream out(L"习题9-10输出.txt"); //创建文件宽输入流
in.imbue(loc); //为in设置编码方案
out.imbue(loc); //为out设置编码方案
wstring line; //用来存储一行内容
map<wchar_t, int> counter;
while(getline(in,line))
{
for(int i=0; i<line.length(); ++i)
{
counter[line[i]] ++;
}
}
map<wchar_t, int>::iterator itor;
int i = 1;
for(itor=counter.begin(); itor != counter.end(); ++itor, ++i)
{
out<<itor->first<<"\t"<<itor->second<<"\t";
if(i%4 == 0)
{
out<<endl;
}
}
in.close();
out.close();
return 0;
}
int i = 1;
for(itor=counter.begin(); itor != counter.end(); ++itor, ++i)
{
out<<itor->first<<"\t"<<itor->second<<"\t";
if(i%4 == 0)
{
out<<endl;
}
}
in.close();
out.close();
return 0;
}
阅读全文
0 0
- 77、78、79
- LeetCode39/40/22/77/17/78/51/46/47/79 10道 Backtracking**
- 稳压器78系列和79系列含义
- 稳压器78系列和79系列含义
- 78系列79系列稳压芯片
- leetcode之深搜递归回溯类之排列与组合类-----77/39/40/216/317 组合 78/90/368 子排列 22/79/93/131 典型递归回溯 46/47 全排列
- 王世鹏3分绝杀!中国78:77斯诺文尼亚 晋级
- 三端集成稳压器的问题(78L05/78M05/79L05)
- 三端稳压集成芯片(78L05/78M05/79L05)
- 78
- 78
- 78
- 78
- 78
- 78
- 78
- 三端稳压芯片78xx/79xx的功耗和散热
- 三端稳压芯片78xx/79xx的功耗和散热
- C#设计模式---单例模式
- 图形数据库 Neo4j 开发
- This version of MySQL doesn't yet support 'LIMIT & IN/ALL/ANY/SOME subquery'
- oj 3058: 算法设计:直接插入排序
- rman备份到磁带库注意事项
- 77、78、79
- 三款程序员必备神器,爆炸!
- Neo4j运行原理
- 利用 Keras 下的 LSTM 进行情感分析
- JDBC DAO层SQL语句操作
- 80、81、82
- 【整理归纳】Linux中 vim 快捷键
- 关于Java自动识别日期并且转换成为指定日期
- Neo4j图数据库简介和底层原理