摘要: 使用递归:#include<iostream>using namespace std;struct ListNode{ int value; ListNode *next;};void Print(ListNode *list){ if(list!=NULL) { if(list->next!=NULL) Print(list->next); cout<<list->value<<endl; } }int main(){ int n; while(cin>>n) { ListNode *head=(ListNode*)mallo 阅读全文
posted @ 2012-12-29 22:40 代码改变未来 阅读(197) 评论(0) 推荐(0) 编辑
摘要: #include<iostream>#include<string>using namespace std;void ReplaceBlank(char *str,int length){if(str==NULL&&length<0)return;int i=0;int j=0;for(i=0;str[i]!='\0';i++){if(str[i]==' ')j++;}int newlength=i+2*j;if(newlength>=length)return;int l=i-1;for(int k=newl 阅读全文
posted @ 2012-12-29 19:10 代码改变未来 阅读(141) 评论(0) 推荐(0) 编辑