您的位置:首页 > 编程语言

UVA - 272 TEX Quotes

2017-09-02 11:21 351 查看
//入门经典P47 水题
#include <cstdio>
int main()
{
int c, q = 1;
while ((c = getchar()) != EOF)
{
if (c == '"')
{
printf("%s", q?"``":"''");
q = 1 - q;
}
else printf("%c", c);

}
return 0;
}
/*
#include <iostream>
#include <cstdio>
using namespace std;
int main()
{
int c, j = 1;
while ((c = getchar()) != EOF)
{
if (c == '"')
{
cout << (j?"``":"''");
j = !j;
}
else
cout << (char)c;
}
return 0;
}
*/
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息