美观化文字
来源:互联网 发布:携程首席数据官 编辑:程序博客网 时间:2024/05/21 23:43
#include<iostream>
#include<cstring>
#include<stdio.h>
#include<string>
using namespace std;
int main()
{
int temp,sum,i;
char s[10000];
while(gets(s))
{
int n=strlen(s);
sum=0;
for(i=0;i<n;i++)
{
string temp="";
temp=temp+s[i]+s[i+1];
if(temp=="“"||temp=="”")
{
sum++;
}
if(s[i]=='"')
{
if(sum%2==0)
printf("“");
else
printf("”");
sum++;
}
else if(s[i]==',')printf(",");
else if(s[i]=='.')
printf("。");
else if(s[i]=='!')
printf("!");
else if(s[i]=='?')
printf("?");
else if(s[i]=='<'&&s[i+1]=='<')
{
i++;
printf("《");
}
else if(s[i]=='>'&&s[i+1]=='>')
{
i++;
printf("》");
}
else printf("%c",s[i]);
}printf("\n");
}
return 0;
}
#include<cstring>
#include<stdio.h>
#include<string>
using namespace std;
int main()
{
int temp,sum,i;
char s[10000];
while(gets(s))
{
int n=strlen(s);
sum=0;
for(i=0;i<n;i++)
{
string temp="";
temp=temp+s[i]+s[i+1];
if(temp=="“"||temp=="”")
{
sum++;
}
if(s[i]=='"')
{
if(sum%2==0)
printf("“");
else
printf("”");
sum++;
}
else if(s[i]==',')printf(",");
else if(s[i]=='.')
printf("。");
else if(s[i]=='!')
printf("!");
else if(s[i]=='?')
printf("?");
else if(s[i]=='<'&&s[i+1]=='<')
{
i++;
printf("《");
}
else if(s[i]=='>'&&s[i+1]=='>')
{
i++;
printf("》");
}
else printf("%c",s[i]);
}printf("\n");
}
return 0;
}
0 0
- 美观化文字
- zzuli 1524 美观化文字
- hdoj 1736 美观化文字
- Hdoj 1736 美观化文字
- HDU 1736 美观化文字 water~~~
- HDOJ 1736:美观化文字 很考验思维的缜密
- hdu 1736 美观化文字 中文字符处理
- PPT流程文字转变为美观图形
- 比赛结果展示时,某些文字过长,如何使其换行又不影响美观?
- 美观DropDownList
- VS2010美观
- ,表格美观显示
- 美观是个陷阱
- 美观下拉框实例
- 各种美观DIV样式
- 实现美观的TabHost
- 大码美观优化
- 最小美观程度
- GameBuilder开发游戏应用系列之60行代码实现FlappyBird
- 网页编码的三要素
- java中的接口
- Java中String 操作及前期绑定与后期绑定例子
- 算法训练 最短路
- 美观化文字
- 第5章2节《MonkeyRunner源码剖析》Monkey原理分析-启动运行: 启动流程概览(原创)
- hdu 5183 Negative and Positive (NP)
- 从C程序分析计算机执行指令的过程
- ACM-BestCoder Round #32
- java ServerSocket 用法详解(二)
- android 获取本地全部图片列表的实现及源码下载(二)
- linux学习笔记:本地如何上传文件到linux服务器
- 使用C++实现一套简单的状态机模型——原理解析