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''.
源代码:
#include<iostream>
#include<stdio.h>
using namespace std;
int main()
{
    int c,h=1;
    while((c=getchar())!=EOF)
    {
       if(c=='"')
       {
         if(h)
           cout<<"``";
         else
         cout<<"''";
         h=!h;
        }
        else
         cout<<char(c);
    }
    return 0;
}




知识点:
1
int c;
while(c=getchar)
{
    cout<<char(c);
可用来输入含有空格和回车的字符串
头文件#include<stdio.h>


h=!h  如果h=0,!h=1;
如果h属于N+,!h等于0


3
while(a!=EOF)
的意思:除非按下ctrl+z,否则就不会跳出循环,但在getchar()函数这里不知道为什么,EOF这句有没有都不起作用

原文地址:https://www.cnblogs.com/iamjuruo/p/7470980.html