码迷,mamicode.com
首页 > 其他好文 > 详细

TeX中的引号

时间:2017-12-25 20:59:09      阅读:116      评论:0      收藏:0      [点我收藏+]

标签:getch   not   div   stdio.h   clu   nbsp   printf   包含   main   

在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 <iostream>
#include <stdio.h>

using namespace std;

int main()
{
    int c, q = 1;
    while((c = getchar()) != EOF)
    {
        if (c == ")
        {
            printf("%s", q?"``" : "‘‘");
            q = !q;
        }
        else
        {
            cout<<char(c);
        }
    }

    return 0;
}

 

TeX中的引号

标签:getch   not   div   stdio.h   clu   nbsp   printf   包含   main   

原文地址:https://www.cnblogs.com/2228212230qq/p/8110928.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!