//Tex中的引导
#include<stdio.h>
int main(){
int a,b=1;
while(~(a=getchar())){
if(a=='"'){
printf("%s",b?"&":"*");
b=!b;
}
else printf("%c",a);
}
}
个人练习
如何判断左右引号,加入标志判断
注意是scanf("%s",c)不能读空格等
【题目】
在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''.
详解见
https://blog.youkuaiyun.com/Pleaseinput/article/details/79791227
该篇博客介绍了一个C语言程序,用于将输入的含有双引号的文章转换为TeX格式。程序通过标志变量判断左右引号,并正确输出TeX中的``和''。适合对字符处理和文本格式转换感兴趣的读者学习。
1013

被折叠的 条评论
为什么被折叠?



