标签:字符串处理专题
题目信息如下:
在Tex中,左括号是”,右括号是“。
输入一篇包含双引号的文章,你的任务是把它转换成Tex的格式。
阳历输入:
”To be or not to be,"quoth the Bard,"that is the question".
样例输出:
“To be or not to be,”quoth the Bard,“that is the question”.
代码如下:
#include<stdio.h>
int main()
{
int ok=1;
char c;
while((c=getchar())!=EOF)
{
if(c=='"')
{
printf("%s",ok?"“":"”");
ok=!ok;
}
else
putchar(c);
}
return 0;
}标签:字符串处理专题
原文地址:http://blog.csdn.net/ice_alone/article/details/39209151