首页 > 其他 > 详细

Tex括号(字符串处理,有陷阱)

时间:2014-09-11 19:28:12      阅读:241      评论:0      收藏:0      [点我收藏+]

题目信息如下:

在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;
}


Tex括号(字符串处理,有陷阱)

原文:http://blog.csdn.net/ice_alone/article/details/39209151

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!