曾经做过一个类似的,也是对双引号进行修改。
这题要使用整行读人,我习惯使用gets()函数,当然也有其他的函数get(cin,string s)、cin.getline(charArray, max_length,'\n')。但有时做字符串题时会发生与换行符有关的错误,不能理解!
Sample Input
"To be or not to be," quoth the Bard, "thatis the question".The programming contestant replied: "I must disagree.To `C' or not to `C', that is The Question!"
Sample Output
``To be or not to be,'' quoth the Bard, ``thatis the question''.The programming contestant replied: ``I must disagree.To `C' or not to `C', that is The Question!''
Source Code
#include#include const int N = 1000;int main(){ int i,j,cnt=0; char src[N],dst[N]; while(gets(src)){ for(i=j=0;i