c++ prime 10.3.9

include <iostream>
#include<stdexcept>
#include <string>
#include <map>
#include <fstream>
#include <sstream>


using namespace std;
ifstream& open_file(ifstream&,const string&);

int main(int argc, char **argv)
{
    map<string, string> trans_map;
    string key, value;
    if (argc!= 3)
      throw runtime_error("wrong number of arguments");
    ifstream map_file;
    if (!open_file(map_file, argv[1]))
      throw runtime_error("no transformation file");
    while (map_file>>key>>value)
      trans_map.insert(make_pair(key, value));
    ifstream input;
    if (!open_file(input, argv[2]))
      throw runtime_error("no input file");
    string line; 
    while (getline(input, line))
    { 
      istringstream stream(line);
        string word;
        bool firstword = true;
        while (stream >> word) {
            map<string, string>::const_iterator map_it =trans_map.find(word);
            if (map_it != trans_map.end())
              word = map_it->second;
            if (firstword)
              firstword = false;
            else
              cout << " ";
            cout << word;
        }
        cout << endl;
    }
    return 0;
}

ifstream& open_file(ifstream &in,const string &file)
{
    in.close ();
    in.clear ();
    in.open (file.c_str ());
    return in;
}


1.txt

i I
u YOU 
f FUCK
w WHAT
a A
d DAY 

2.txt

i f u 
w a f d 
这样运行

./a.out 1.txt 2.txt 

运行结果

I FUCK YOU
WHAT A FUCK DAY


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
云应用开发 Google App Engine & Google Web Toolkit入门指南 侯炯 目录 第1章 应该了解下 1.1云基本知识 1.2Google App engine 1.3Google Web Toolkit 第2章 环境搭建 2.1安装JDK 2.2安装Eclipse 2.3安装SDK和Eclipse插件 第3章 Hello World! 3.1 创建项目 3.2 目录结构说明 3.3 修改文件 3.4 运行调试 第4章 华丽的控件 4.1 显示文本——Lable,HTML 4.2 方形选择框——CheckBox 4.3 圆形选择框——RadioButton 4.4 按钮——Button 4.5 自定义按钮——PushButton,ToggleButton 4.6 文件上传——FileUpload 4.7 时间选择器——DatePicker 4.8 列表控件——ListBox 4.9 联想输入框——Suggest Box 4.10 树结构——Tree 4.11 菜单条——MenuBar 4.12 栈板——StackPanel 4.13 基本输入框的——TextBox,PasswordTextBox,TextArea 4.14 弹出框框——RichTextArea 4.15 弹出对话框——DialogBox 4.16 修饰面板——DecoratorPanel 4.17 自然布局面板——FlowPanel 4.18 水平布面板——HorizontalPanel 4.19 垂直布局面板——VerticalPanel 4.20 绝对定位面板——AbsolutePanel 4.21 停靠面板——DockPanel 4.22 展开面板——DisclosurePanel 4.23 标签面板——TablePanel 4.24 水平拆分面板——HorizontalSplitPanel 4.25 垂直拆分面板——VerticalSplitPanel 4.26 网格——Grid 4.27 灵活表格——FlexTable 第5章 装饰控件 5.1 控件的主题 5.2 通过CSS装饰控件 5.3 通过代码修改控件 5.4 实例——火车时刻表 第6章 通信机制 6.1 RPC机制 6.1.1什么是RPC 6.1.2接口函数实现 6.1.3可序列化 6.1.4 注册服务 6.1.5 使用服务 6.1.6 实例——股票价格表RPC版本 6.2 Servlet机制 6.2.1 Servlet介绍 6.2.2 实例——Servlet版本HelloWorld 第7章 数据操作 7.1 概述 7.2 定义数据类 7.3 创建,获取和删除数据 7.4 查询和索引 7.5 事务 7.6 关系 7.7 实例——员工管理系统 第8章 国际化 8.1 普通文本国际化 8.2 参数文本国际化 8.3 实例 第9章 应用托管 9.1 申请Google App Engine账号 9.2 上传应用 9.3 应用维护指南 第10章 实战 10.1 入门例子——股票系统 10.1.1创建项目 10.1.2设计应用 10.1.3建立用户界面 10.1.4创建控件和面板 10.1.5事件处理 10.1.6实现客户端功能 10.1.7添加应用样式 10.1.8国际化 10.1.9服务器交互 10.1.10让App Engine托管应用 10.2 中级例子——个人网站 10.2.1样子与功能 10.2.2创建项目 10.2.3定义数据结构 10.2.4规定通讯协议 10.2.5实现数据交互和发送邮件功能 10.2.6注册提供服务 10.2.7总体界面设计 10.2.8首页界面实现 10.2.9日志界面实现 10.2.10关于我界面实现 10.2.11留言界面实现 10.2.12管理界面实现 10.2.13统筹界面和连接功能 10.2.14国际化 10.2.15欢迎界面和样式文件修改 10.2.16总结 10.3 高级例子——号码管家(GAE+GWT+Android) 10.3.1样子与功能 10.3.2创建项目 10.3.4规定通讯协议 10.3.5实现服务端的功能 10.3.6注册提供服务 10.3.7帮助界面设计 10.3.8服务条款界面设计 10.3.9编辑界面设计 10.3.10登陆界面设计 10.3.11列表界面设计 10.3.12统筹界面和连接功能 10.3.13国际化 10.3.14欢迎界面和样式文件修改 10.3.15手机端界面与功能实现 10.3.16总结

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值