CCF模板生成工具
来源:互联网 发布:金山数据恢复收费吗 编辑:程序博客网 时间:2024/05/18 18:21
#include<iostream>
#include<stdio.h>
#include<map>
#include<algorithm>
#include<String>
using namespace std;
int main()
{
int tvarNum,cvarNum;//文本行数tvarNum,对应的变量行数cvarNum
cin>>tvarNum>>cvarNum;//输入变量
string input,output,temp;
map<string,string> varDict;
getchar();//除去回车键符
for(int i=0;i<tvarNum;i++)//将文本中各行输入
{
getline(cin,temp);//输入一行
input+=temp+'\n';//换行
}
string key,value;
for(int i=0;i<cvarNum;i++)
{
cin>>key;
getline(cin,temp);
int startQ=temp.find("\"");
int endQ=temp.rfind("\"");
cout<<startQ<<endQ<<endl;
value=temp.substr(startQ+1,endQ-startQ-1);
varDict[key]=value;
}
int startPos, endPos; // startPos->{{ endPos->}}
int startPoint = 0; // start position for string.find
int ss=2;
while(ss) {
startPos = input.find("{{", startPoint);
endPos = input.find("}}", startPos);
if(startPos<0||endPos<0) break;
key=input.substr(startPos+2,endPos-startPos-4);
value="";
if(varDict.find(key)!=varDict.end()) value=varDict[key];
output+=input.substr(startPoint,startPos-startPoint)+value;
startPoint=endPos+2;
}
ouput+=input.substr(startPoint,input.size());
return 0;
}
#include<stdio.h>
#include<map>
#include<algorithm>
#include<String>
using namespace std;
int main()
{
int tvarNum,cvarNum;//文本行数tvarNum,对应的变量行数cvarNum
cin>>tvarNum>>cvarNum;//输入变量
string input,output,temp;
map<string,string> varDict;
getchar();//除去回车键符
for(int i=0;i<tvarNum;i++)//将文本中各行输入
{
getline(cin,temp);//输入一行
input+=temp+'\n';//换行
}
string key,value;
for(int i=0;i<cvarNum;i++)
{
cin>>key;
getline(cin,temp);
int startQ=temp.find("\"");
int endQ=temp.rfind("\"");
cout<<startQ<<endQ<<endl;
value=temp.substr(startQ+1,endQ-startQ-1);
varDict[key]=value;
}
int startPos, endPos; // startPos->{{ endPos->}}
int startPoint = 0; // start position for string.find
int ss=2;
while(ss) {
startPos = input.find("{{", startPoint);
endPos = input.find("}}", startPos);
if(startPos<0||endPos<0) break;
key=input.substr(startPos+2,endPos-startPos-4);
value="";
if(varDict.find(key)!=varDict.end()) value=varDict[key];
output+=input.substr(startPoint,startPos-startPoint)+value;
startPoint=endPos+2;
}
ouput+=input.substr(startPoint,input.size());
return 0;
}
0 0
- CCF模板生成工具
- 【CCF】模板生成系统
- CCF模板生成系统
- CCF模板生成系统
- ccf 模板生成系统
- CCF 模板生成系统
- ccf模板生成系统
- CCF-模板生成系统
- CCF模板生成系统
- CCF之模板生成
- CCF 模板生成系统
- 【CCF 模板生成系统 水】
- ccf 20150903 模板生成系统
- 2015年9月CCF计算机软件能力认证题:模板生成工具
- ccf 201509-3 模板生成系统
- CCF CSP 201509-3 模板生成系统
- CCF 201509-3 模板生成系统
- CCF 201509-3 模板生成系统
- Practice6_3_map_sort
- Find Largest Value in Each Tree Row
- nginx 在linux 上启动 /usr/local/Nginx/logs/Nginx.pid 文件无法找到
- ActiveMQ集群搭建
- 开脑洞,用声音DEBUG
- CCF模板生成工具
- 什么是XSS攻击
- Git——Day2(开源项目贡献流程)
- Java编写高质量的方法
- vim编辑器的常用操作
- 借助Nginx搭建反向代理服务器
- 冒泡排序算法(C++实现)
- 常用Servlet过滤器
- DescriptionResourcePathLocationType The superclass "javax.servlet.http.HttpServlet" was not foun