《数据结构编程实验》 4.5.1TEX Quotes

来源:互联网 发布:越狱软件源 编辑:程序博客网 时间:2024/05/16 06:04

题目大意:

  将双引号字符"改成``和''。


题目地址:

  POJ  1488 ZOJ  272


题解:

  题目很简单,但是书上的参考程序有点意思。


#include <iostream>#include <cstdio>using namespace std;int main(){    int b=0;    char c,s[2][5]={"``","''"};    while (scanf("%c",&c)!=EOF)    {        if (c=='"')        {            printf("%s",s[b]);            b=!b;        }        else printf("%c",c);    }    return 0;}



0 0