本文主要是介绍TeX括号,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
在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”.
PS:本题的关键是,如何判断一个双引号是左双引号还是右双引号。方法很简单:使用一个标志变量即可。
#include <iostream>
#include <cstdio>
using namespace std;
int main()
{int c,q=1;while((c=getchar())!=EOF){if(c=='"'){printf("%s",q?"“":"”");q=!q;}elseprintf("%c",c);}return 0;
}
//"To be or not to be,"quoth the Bard,"that is the question".
这篇关于TeX括号的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!