將文章中成對的雙引號加上方向性
[心得]
1. 不要用system("PAUSE")
2.輸入一整句,使用gets(text)
3.計算string長度,使用strlen(text)
#include <stdio.h>
#include <string.h>
int main()
{
char text[1000];
int len;
int i;
int n=0;
while(gets(text))
{
len=strlen(text);
for(i=0;i<len;i++)
{
if(text[i]=='"')
{
n++;
if(n%2==1) printf("``");
else printf("''");
}
else printf("%c",text[i]);
}
printf("\n");
}
return 0;
}
全站熱搜
留言列表